def is_can_submit_jobs()

in tools/mediasync/lambda/driver/app.py [0:0]


def is_can_submit_jobs():

    # we don't have a good way of checking how many pending jobs as yet
    # without having to build an API

    disable_pending_jobs_test = os.environ['DISABLE_PENDING_JOBS_CHECK']

    if (disable_pending_jobs_test == False):

        ##check how many jobs are pending
        listjobs = batchclient.list_jobs(
            jobQueue=os.environ['JOB_QUEUE'],
            jobStatus='RUNNABLE',
            maxResults=int(os.environ['MAX_NUMBER_OF_PENDING_JOBS'])
        )

        if ('nextToken' in listjobs):
            return False
    else:
        logger.debug("Pending jobs check is disabled")

    return True