Last active
November 5, 2023 21:30
-
-
Save ustroetz/b38d5519afc8dab0196669ded7b9ecf4 to your computer and use it in GitHub Desktop.
Lambda function to trigger dependent AWS Batch jobs
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
def handler(event, context): | |
client = boto3.client('batch', 'us-east-1') | |
analyzer_job = client.submit_job( | |
jobName='ma-analyzer', | |
jobQueue='ma', | |
jobDefinition='ma-analyzer:1', | |
containerOverrides={ | |
'command': ['python', 'service.py'] | |
}) | |
aggregator_job = client.submit_job( | |
jobName='ma-aggregator’, | |
jobQueue='ma', | |
dependsOn=[ | |
{ | |
'jobId': analyzer_job['jobId'] | |
}, | |
], | |
jobDefinition='ma-aggregator:1', | |
containerOverrides={ | |
'command': ['python', 'service.py'] | |
}) | |
client.submit_job( | |
jobName='ma-deploy', | |
jobQueue='ma', | |
dependsOn=[ | |
{ | |
'jobId': aggregator_job['jobId'] | |
}, | |
], | |
jobDefinition='ma-deploy:1', | |
containerOverrides={ | |
'command': ['python', 'service.py'] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment