-
Notifications
You must be signed in to change notification settings - Fork 54
feat: Implement an example CloudFormation for a custom Deadline Cloud Balancer #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Ahuge
wants to merge
8
commits into
aws-deadline:mainline
Choose a base branch
from
Ahuge:ah/feature/custom-balancer
base: mainline
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
95cd4f1
Create a Custom Job Balancer sample
Ahuge ab1dc5b
Implement nice README files for our new balancer
Ahuge 6ac4a12
Implement our balancing adjustments
Ahuge 0cc5b19
Square the priority factor
Ahuge 932a2f1
Update lambda code to use paginators
Ahuge 00a5bd5
refactor: Adjusting the custom balancer code
Ahuge 74a77f1
Refactor Lambda to expect event to match Job Lifecycle Status Change …
Ahuge fccbd53
Add support for responding to Job Lifecycle Status Change events
Ahuge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # AWS Deadline Cloud Auxiliary Templates | ||
|
|
||
| ## Introduction | ||
| AWS Deadline Cloud sends events to customer's default event bus https://docs.aws.amazon.com/deadline-cloud/latest/userguide/monitoring-eventbridge.html | ||
| This directory holds sample Cloud Formation Templates customers can use to customize behaviour based on events received from Deadline Cloud. | ||
|
|
||
| ## Setup Instructions | ||
| Each Cloud Formation Template will have its own instructions on how to set up integrations, but in general they follow the below scheme: | ||
|
|
||
| 1. Download the specified YAML file | ||
| 2. On the AWS console, go to CloudFormation, Create Stack, and add the downloaded template. | ||
| 3. Follow the specific instructions for that file, as you may need to enter specific parameters. | ||
| 4. After this is set up, Deadline cloud events will reach through your setup mechanism. |
59 changes: 59 additions & 0 deletions
59
cloudformation/auxiliary_templates/custom_balancer/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Deadline Custom Job Balancer | ||
|
|
||
| This CloudFormation template deploys a Lambda function that controls the maxWorkerCount for each job within a Queue to implement functionality similar to the Deadline10 Balancer options. | ||
| It implements a modified version of the Deadline 10 weighting algorithm: https://docs.thinkboxsoftware.com/products/deadline/10.4/1_User%20Manual/manual/job-scheduling.html#weighted-scheduling | ||
|
|
||
| ## Resources Created | ||
| 1. **Lambda Function**: An AWS Lambda function named `DeadlineWeightedJobBalancer` is created. This is the main driver which calculates and controls the `maxWorkerCount` setting for jobs. | ||
| 2. **EventBridge Schedule**: A schedule is created to trigger the Lambda function once every minute. | ||
| 3. **IAM Role**: An IAM role `BalancerSchedulerRole` is created and used by the Schedule to trigger the Lambda function. | ||
| 4. **SQS Queue**: An SQS Queue `deadline-unprocessed-balancing-events` is created to act as a DeadLetterQueue for the Schedule. | ||
| 5. **IAM Role**: An IAM role `DeadlineWeightedJobBalancerRole` is created to be used as the Lambda execution role for our `DeadlineWeightedJobBalancer`. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before deploying this CloudFormation template, check you have the following as per your chosen method of notifications: | ||
|
|
||
| 1. The AWS CLI installed and configured with your AWS credentials (if setting up using CLI option). | ||
| 2. A Deadline Cloud Farm and Queue deployed in your account. | ||
|
|
||
| ## Deployment | ||
|
|
||
| You can use either of the below methods for deployment - AWS Console or AWS CLI. | ||
|
|
||
| ### AWS Console | ||
|
|
||
| To deploy this CloudFormation template via the AWS Console, follow these steps: | ||
|
|
||
| 1. Save the CloudFormation template to a local file (e.g., `/Users/<your-username/Downloads/custom_queue_job_balancer.yaml`). | ||
| 2. Open the AWS CloudFormation console. | ||
| 3. Click on "Create Stack" and select "With new resources (standard)". | ||
| 4. Under "Specify template", choose "Upload a template file" and select the CloudFormation template file saved from location. | ||
| 5. Click "Next". | ||
| 6. On the "Specify stack details" page, provide values for the following parameters: | ||
| - `FarmId`: Enter your Deadline Cloud Farm ID which contains the Queue you'd like to have the balancer target. | ||
| - `QueueId`: Enter the Deadline Cloud Queue ID that you would like to have the balancer target. | ||
| 7. Click "Next" through the remaining steps, and finally, click "Create Stack" to deploy the CloudFormation template. | ||
|
|
||
| ### AWS CLI | ||
|
|
||
| To deploy this CloudFormation template using the AWS CLI, follow these steps: | ||
|
|
||
| 1. Save the CloudFormation template to a local file (e.g., `/Users/<your-username/Downloads/custom_queue_job_balancer.yaml`). | ||
| 2. Open a terminal or command prompt, and navigate to the directory containing the template file. | ||
| 3. Run the following AWS CLI command to create the CloudFormation stack: | ||
|
|
||
| ``` | ||
| aws cloudformation create-stack \ | ||
| --stack-name DeadlineCustomBalancer<QueueId> \ | ||
| --template-body file://custom_queue_job_balancer.yaml \ | ||
| --parameters \ | ||
| ParameterKey=FarmId,ParameterValue=farm-XXXXXXXXX \ | ||
| ParameterKey=QueueId,ParameterValue=queue-XXXXXXXXX | ||
| ``` | ||
|
|
||
| Replace `farm-XXXXXXXXX`, and `queue-XXXXXXXXX` with your actual values. | ||
|
|
||
| 4. Wait for the stack creation to complete. You can monitor the progress using the `aws cloudformation describe-stacks` command. | ||
|
|
||
| After successful deployment & confirmation, you should start seeing the `maxWorkerCount` get automatically modified for each job in your queue. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.