def run_job()

in gremlin/glue-neptune/notebooks/glue_utils.py [0:0]


def run_job(job_name):
    
    status = Status(job_name)
    
    job_run_id = ''
    is_starting = True
    
    while is_starting:
        try: 
            job_run_id = client.start_job_run(JobName=job_name)['JobRunId']
            is_starting = False
        except ClientError as e:
            if e.response['Error']['Code'] == 'ConcurrentRunsExceededException':
                time.sleep(5)
            else:
                raise(e)
    
    response = {}
    job_run_state = ''
    is_running = True
    
    while is_running:
        response = client.get_job_run(JobName=job_name, RunId=job_run_id)
        job_run_state = response['JobRun']['JobRunState']
        if job_run_state == 'STOPPED' or job_run_state == 'SUCCEEDED' or job_run_state == 'FAILED':
            is_running = False
        else:
            status.update()
            time.sleep(5)
    
    status.finish()
            
    return job_run_state