Example #1
0
def list(ctx, queue):
    """
    List running jobs.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    lines, runnable_count = mgr.list_jobs(queue)
    for line in lines:
        click.echo(line)
Example #2
0
def status(ctx, queue):
    """
    Get the number of jobs per status in queue
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    lines, runnable_count = mgr.list_jobs(queue)
    for line in lines:
        click.echo(line)
Example #3
0
def terminate(ctx, queue):
    """
    Terminate all jobs.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.terminate_all_jobs(queue)
    while True:
        lines, runnable_count = mgr.list_jobs(queue)
        for line in lines:
            click.echo(line)
        if runnable_count == 0:
            break
        time.sleep(5)
Example #4
0
def cancel(ctx, queue):
    """
    Cancel all jobs.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    mgr.cancel_all_jobs(queue)
    while True:
        lines, runnable_count = mgr.list_jobs(queue)
        for line in lines:
            click.echo(line)
        if runnable_count == 0:
            break
        time.sleep(5)
Example #5
0
def submit(ctx, name, job_definition, queue, parameters, nowait):
    """
    Submit jobs to AWS Batch. Each line of the parameters file will result in a job.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    if parameters:
        mgr.submit_jobs(name, job_definition, queue, parameters_csv=parameters)
    else:
        mgr.submit_job(name, job_definition, queue)
    while True:
        lines, runnable_count = mgr.list_jobs(queue)
        for line in lines:
            click.echo(line)
        if runnable_count == 0 or nowait:
            break
        time.sleep(5)
Example #6
0
def submit(ctx, name, job_definition, queue, parameters, nowait):
    """
    Submit jobs to AWS Batch. Each line of the parameters file will result in a job.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    if parameters:
        with open(parameters) as csvfile:
            # first line is parameter names
            reader = csv.DictReader(csvfile)
            for row in reader:
                mgr.submit_job(name, job_definition, queue, parameters=row)
    else:
        mgr.submit_job(name, job_definition, queue)
    while True:
        lines, runnable_count = mgr.list_jobs(queue)
        for line in lines:
            click.echo(line)
        if runnable_count == 0 or nowait:
            break
        time.sleep(5)