Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lambda function to trigger dependent AWS Batch jobs
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