Skip to content

Commit d1fc8c1

Browse files
authored
feat: add Batch Fargate Job for CPU rendering (#4)
1 parent d957f17 commit d1fc8c1

20 files changed

+11923
-41
lines changed

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
indent_style = space
12+
indent_size = 4
13+
14+
# Tab indentation (no size specified)
15+
[Makefile]
16+
indent_style = tab
17+
18+
[*.json]
19+
indent_size = 2

.gitignore

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.npmignore

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.prettierignore

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projen/deps.json

+12-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projen/tasks.json

+41-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const { awscdk } = require('projen');
22
const { NodePackageManager } = require('projen/lib/javascript');
33

4+
const cdkVersion = '2.69.0';
5+
const alphaVersionSuffix = 'alpha.0';
6+
47
const project = new awscdk.AwsCdkConstructLibrary({
58
name: 'cdk-blender-render',
69
description: 'Render Blender with AWS',
@@ -11,15 +14,17 @@ const project = new awscdk.AwsCdkConstructLibrary({
1114

1215
stability: 'experimental',
1316
defaultReleaseBranch: 'main',
14-
keywords: ['aws', 'cdk', 'blender', 'render'],
17+
keywords: ['aws', 'batch', 'blender', 'cdk', 'render'],
1518

1619
docgen: false,
1720

18-
// releaseToNpm: false,
19-
// publishTasks: false,
21+
releaseToNpm: true,
22+
publishTasks: true,
2023
packageManager: NodePackageManager.NPM,
2124

22-
cdkVersion: '2.30.0',
25+
cdkVersion: cdkVersion,
26+
27+
peerDeps: [`@aws-cdk/aws-batch-alpha@^${cdkVersion}-${alphaVersionSuffix}`],
2328

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

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

5560
// .gitignore
5661
project.gitignore.exclude(...common_exclude);

Makefile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
build:
2+
npx projen build
3+
4+
docker-build-cpu:
5+
cd resources/docker && \
6+
docker build . \
7+
-f cpu.Dockerfile \
8+
-t blender-cpu:latest \
9+
--platform=linux/amd64
10+
11+
# TODO fix for Mac M1
12+
docker-test-cpu:
13+
docker run \
14+
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
15+
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
16+
-e AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN} \
17+
-e AWS_DEFAULT_REGION=eu-west-2 \
18+
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
19+
20+
docker-build-gpu:
21+
cd resources/docker && \
22+
docker build . \
23+
-f gpu.Dockerfile \
24+
-t blender-gpu:latest \
25+
--platform=linux/amd64
26+
27+
docker-test-gpu:
28+
docker run \
29+
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
30+
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
31+
-e AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN} \
32+
-e AWS_DEFAULT_REGION=eu-west-2 \
33+
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
34+
35+
blender-local-test:
36+
cd resources/blender && \
37+
blender -b blender_example.blend -o "frames"/ -f 1 -- --cycles-device "${RENDER_MODE}"
38+
39+
compile:
40+
npx projen compile
41+
42+
package:
43+
npx projen package:js
44+
45+
ship:
46+
@make compile
47+
@make package

README.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
2+
# ! warning !
3+
`cdk-blender-render` is currently under active development. Contributions of any kind welcome!
4+
5+
16
# cdk-blender-render
2-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3-
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
4-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
7+
Deploy `cdk-blender-render` in your AWS account and Render Blender with AWS Batch.
8+
9+
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/).
10+
11+
Follow [Rendering Blender Projects With Aws Batch](https://ec2spotworkshops.com/rendering-with-batch.html) for mode detailed instructions.
512

613
## Contributors ✨
714

0 commit comments

Comments
 (0)