- Newest
- Most votes
- Most comments
Hi John,
You can use this python script as reference and modify according to your need.
import boto3
Create Batch and S3 clients
batch_client = boto3.client('batch') s3_client = boto3.client('s3')
Specify the job queue name
job_queue_name = 'your-job-queue-name'
Retrieve the list of failed job names
failed_job_names = [] response = batch_client.list_jobs(jobQueue=job_queue_name, jobStatus='FAILED') while 'nextToken' in response: failed_job_names.extend([job['jobName'] for job in response['jobSummaryList']]) response = batch_client.list_jobs(jobQueue=job_queue_name, jobStatus='FAILED', nextToken=response['nextToken']) failed_job_names.extend([job['jobName'] for job in response['jobSummaryList']])
Write the list of failed job names to a file
with open('failed_job_names.txt', 'w') as f: f.write('\n'.join(failed_job_names))
Upload the file to an Amazon S3 bucket
s3_client.upload_file('failed_job_names.txt', 'your-s3-bucket-name', 'failed_job_names.txt')
Relevant content
- asked 6 months ago
- asked 5 months ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
Hi Vinit, Is there a documentation that shows using boto3 on aws batch?
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/batch.html