Skip to content

Commit

Permalink
changes to adhere to common hugo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ruecarlo committed Nov 7, 2021
1 parent 201e44b commit 98ecf7e
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 15 deletions.
16 changes: 9 additions & 7 deletions content/rendering-with-batch/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ weight: 80
pre: "<b>8. </b>"
---

{{% notice info %}}
The estimated completion time of this lab is **60 minutes**. Please note Rendering the animation presented below can incur in costs up to **$15**.
{{% /notice %}}
## Overview

In this workshop you will learn to submit jobs with [AWS Batch](https://aws.amazon.com/batch/) following Spot best practices to [render](https://en.wikipedia.org/wiki/Rendering_(computer_graphics)) a [Blender](https://www.blender.org/) file in a distributed fashion, running a Docker container that you will create and publish to Amazon Elastic Container Registry (ECR). [Spot instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html) are EC2 spare capacity offered at steep discounts compared to On-Demand instances and are a cost-effective choice for applications that can be interrupted, what makes them well-suited for the batch processing that we will run. After going through all the sections, you will have the following pipeline created:
In this workshop you will learn to submit jobs with [AWS Batch](https://aws.amazon.com/batch/) following Spot best practices to [render](https://en.wikipedia.org/wiki/Rendering_(computer_graphics)) a [Blender](https://www.blender.org/) file in a distributed way. You will be creating a docker container and publishing it in Amazon Elastic Container Registry (ECR). Then you will use that container in AWS Batch using a mix of EC2 On-Demand and Spot instances. [Spot instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html) are EC2 spare capacity offered at steep discounts compared to On-Demand instances and are a cost-effective choice for applications that can be interrupted, what makes them well-suited for the batch processing that we will run. After going through all the sections, you will have the following pipeline created:

1. A python script downloads the Blender file from S3 to extract the number of frames.
2. The script submits a Batch array job (rendering job) of dimension *n* depending on the number of frames. It also submits a single job (stitching job) with a sequential dependency on the rendering job. (You will learn more about job dependencies later).
1. A python script downloads the Blender file from S3 to extract the number of frames from the Blender project.
2. The script submits a Batch using an `array job` with as many tasks as number of frames. It also submits a single stitching job using [FFmpeg](https://ffmpeg.org/) to create a final video file.
3. Each of the jobs in the rendering job array run a Docker container that executes Blender to render a slice of frames, and after uploads them to S3.
4. The stitching job runs a Docker container that downloads all the frames from S3, executes [FFmpeg](https://ffmpeg.org/) (you will learn more about it in a future section) to create a video out of the rendered frames and finally uploads it to S3.

To have an idea of what you will be rendering, take a look to this animation.
The outcome of the workshop would be the following animation.

![Possible output](/images/rendering-with-batch/animation_example.gif)
![Pottery output](/images/rendering-with-batch/animation_example.gif)

This output is the result of rendering the project *[Pottery](https://blendswap.com/blend/28661)* by [Prokster](https://blendswap.com/profile/1012752), that is shared under the [Creative Commons 0](https://creativecommons.org/share-your-work/public-domain/cc0/) license. Head to the next page to take a look at the architecture that you will deploy.
This output is the result of rendering the project *[Pottery](https://blendswap.com/blend/28661)* by [Prokster](https://blendswap.com/profile/1012752). We thank **Prokster** for providing the project under the [Creative Commons 0](https://creativecommons.org/share-your-work/public-domain/cc0/) license. Head to the next page to take a look at the architecture that you will deploy.
File renamed without changes.
2 changes: 1 addition & 1 deletion content/rendering-with-batch/start/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ To start the workshop head to one of the following pages, depending whether you
When you finish the workshop, don't forget to execute the commands described in [**Clean up**](/rendering-with-batch/cleanup.html) to prevent incurring in additional charges.

{{% notice info %}}
The estimated completion time of this lab is **60 minutes**. Rendering the same animation that you have seen in the previous page, you will incur in an estimated cost of **$15**.
The estimated completion time of this lab is **60 minutes**. Rendering the animation that in this workshop you will incur in an estimated cost of up to **$15**.
{{% /notice %}}
4 changes: 3 additions & 1 deletion content/rendering-with-batch/start/at-an-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ You are now logged in to the AWS console in an account that was created for you,
- An instance profile for AWS Batch compute environment
- The Cloud9 environment where you will run all the commands

{{% content "static/pages/rendering-with-batch/review-outputs.md" %}}


{{% insert-md-from-file file="rendering-with-batch/start/review-outputs.md" %}}
4 changes: 2 additions & 2 deletions content/rendering-with-batch/start/on-your-own.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ weight: 27

## Deploying the CloudFormation stack

As a first step, **download** a [CloudFormation stack](https://raw.githubusercontent.com/awslabs/ec2-spot-workshops/master/content/rendering-with-batch/stack.yaml) that will deploy for you the following resources:
As a first step, **download** a [CloudFormation stack](https://raw.githubusercontent.com/awslabs/ec2-spot-workshops/master/content/rendering-with-batch/rendering-with-batch.files/stack.yaml) that will deploy for you the following resources:

- A VPC
- An S3 bucket
Expand All @@ -24,4 +24,4 @@ After downloading the template, open the [CloudFormation console](https://consol

The stack creation process will begin. All the resources will be ready to use when the status of the stack is `CREATE_COMPLETE`.

{{% content "static/pages/rendering-with-batch/review-outputs.md" %}}
{{% insert-md-from-file file="rendering-with-batch/start/review-outputs.md" %}}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
## Reviewing the Launch Template

A Launch Template has been automatically created for you when deploying the CloudFormation stack. If you had to create it yourself, you would need to follow the instructions specified below.
You can check the CloudFormation stack by downloading the following file: [CloudFormation stack](https://raw.githubusercontent.com/awslabs/ec2-spot-workshops/master/content/rendering-with-batch/rendering-with-batch.files/stack.yaml)

When creating the Batch compute environment, we need to specify some configuration parameters that will be passed on to the EC2 instances when launched, like the Security Group, the Availability Zones and bootstrapping scripts (User data). To encapsulate those properties and be able to easily reuse them, we will use a Launch Template.

The `UserData` of the created Launch Template contains the following script:
Note the `UserData` of the created Launch Template contains the following script:

```bash
MIME-Version: 1.0
Expand All @@ -24,6 +22,7 @@ echo "ECS_ENABLE_CONTAINER_METADATA=true" >> /etc/ecs/ecs.config

What we are doing here is enabling [Spot Instance Draining](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-spot.html). When ECS Spot Instance draining is enabled on the instance, ECS receives the Spot Instance interruption notice and places the instance in DRAINING status. When a container instance is set to DRAINING, Amazon ECS prevents new tasks from being scheduled for placement on the container instance. To learn more about Spot instance interruption notices, visit [Spot Instance interruption notices](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-interruptions.html#spot-instance-termination-notices).


## Gathering the CloudFormation outputs

You will create other AWS resources using the AWS CLI in [Cloud9](https://aws.amazon.com/cloud9/), a cloud-based integrated development environment (IDE) that lets you write, run, and debug your code with just a browser. It includes a code editor, debugger, and terminal. Cloud9 comes prepackaged with essential tools for popular programming languages, including JavaScript, Python, PHP, and more.
Expand Down

0 comments on commit 98ecf7e

Please sign in to comment.