Skip to content

Commit

Permalink
feat: add Batch Fargate Job for CPU rendering (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiamatrix authored Apr 12, 2023
1 parent d957f17 commit d1fc8c1
Show file tree
Hide file tree
Showing 20 changed files with 11,923 additions and 41 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

[*.json]
indent_size = 2
2 changes: 2 additions & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .prettierignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 41 additions & 5 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions .projenrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const { awscdk } = require('projen');
const { NodePackageManager } = require('projen/lib/javascript');

const cdkVersion = '2.69.0';
const alphaVersionSuffix = 'alpha.0';

const project = new awscdk.AwsCdkConstructLibrary({
name: 'cdk-blender-render',
description: 'Render Blender with AWS',
Expand All @@ -11,15 +14,17 @@ const project = new awscdk.AwsCdkConstructLibrary({

stability: 'experimental',
defaultReleaseBranch: 'main',
keywords: ['aws', 'cdk', 'blender', 'render'],
keywords: ['aws', 'batch', 'blender', 'cdk', 'render'],

docgen: false,

// releaseToNpm: false,
// publishTasks: false,
releaseToNpm: true,
publishTasks: true,
packageManager: NodePackageManager.NPM,

cdkVersion: '2.30.0',
cdkVersion: cdkVersion,

peerDeps: [`@aws-cdk/aws-batch-alpha@^${cdkVersion}-${alphaVersionSuffix}`],

devDeps: [
'@trivago/prettier-plugin-sort-imports',
Expand Down Expand Up @@ -50,7 +55,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
// .eslintrc.json
project.eslint.addRules({ 'import/order': 'off' });

const common_exclude = ['cdk.out', 'cdk.context.json', 'yarn-error.log', 'coverage', 'venv'];
const common_exclude = ['cdk.out', 'cdk.context.json', 'yarn-error.log', 'coverage', 'venv', '.env', '*.png'];

// .gitignore
project.gitignore.exclude(...common_exclude);
Expand Down
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
build:
npx projen build

docker-build-cpu:
cd resources/docker && \
docker build . \
-f cpu.Dockerfile \
-t blender-cpu:latest \
--platform=linux/amd64

# TODO fix for Mac M1
docker-test-cpu:
docker run \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-e AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN} \
-e AWS_DEFAULT_REGION=eu-west-2 \
blender-cpu render -m CPU -i "s3://${TEST_BUCKET}/input/examples/blender_example.blend" -o "s3://test-cdk-blender-render-bucket/output" -f 1 -t 1

docker-build-gpu:
cd resources/docker && \
docker build . \
-f gpu.Dockerfile \
-t blender-gpu:latest \
--platform=linux/amd64

docker-test-gpu:
docker run \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-e AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN} \
-e AWS_DEFAULT_REGION=eu-west-2 \
blender-gpu:latest render -m CUDA -i "s3://${TEST_BUCKET}/input/examples/blender_example.blend" -o "s3://test-cdk-blender-render-bucket/output" -f 1 -t 1

blender-local-test:
cd resources/blender && \
blender -b blender_example.blend -o "frames"/ -f 1 -- --cycles-device "${RENDER_MODE}"

compile:
npx projen compile

package:
npx projen package:js

ship:
@make compile
@make package
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@

# ! warning !
`cdk-blender-render` is currently under active development. Contributions of any kind welcome!


# cdk-blender-render
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
Deploy `cdk-blender-render` in your AWS account and Render Blender with AWS Batch.

This is based on the AWS Blog post [Efficient and cost-effective rendering pipelines with Blender and AWS Batch](https://aws.amazon.com/blogs/hpc/efficient-and-cost-effective-rendering-pipelines-with-blender-and-aws-batch/).

Follow [Rendering Blender Projects With Aws Batch](https://ec2spotworkshops.com/rendering-with-batch.html) for mode detailed instructions.

## Contributors ✨

Expand Down
Loading

0 comments on commit d1fc8c1

Please sign in to comment.