Skip to content
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

jobs-db API to support similar options to awscli for list-jobs #57

Open
dazza-codes opened this issue Sep 30, 2021 · 0 comments
Open

jobs-db API to support similar options to awscli for list-jobs #57

dazza-codes opened this issue Sep 30, 2021 · 0 comments

Comments

@dazza-codes
Copy link
Owner

dazza-codes commented Sep 30, 2021

See options for https://awscli.amazonaws.com/v2/documentation/api/latest/reference/batch/list-jobs.html

import boto3
client = boto3.client('batch')
queue = 'project-queue-prod'

query_runnable = client.list_jobs(jobQueue=queue, jobStatus='RUNNABLE')
next_token = query_runnable.get('nextToken')
job_list = query_runnable['jobSummaryList']

while next_token:
    query_runnable = client.list_jobs(jobQueue=queue, jobStatus='RUNNABLE', nextToken=next_token)
    next_token = query_runnable.get('nextToken')
    job_list.extend(query_runnable['jobSummaryList'])

job_names = [r['jobName'] for r in job_list]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant