示例#1
0
def teardown(ctx):
    """
    Teardown (destroy/deregister) all Job Descriptions, Job Queues and Compute Environments in a config file
    :param ctx:
    :return:
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.teardown()
示例#2
0
def assemble(ctx):
    """
    Assemble (create/update) all Job Descriptions, Job Queues and Compute Environments in a config file
    :param ctx:
    :return:
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.assemble()
示例#3
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)
示例#4
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)
示例#5
0
def deregister(ctx, job_definition):
    """
    Deregister an existing job definition.
    :param ctx:
    :param job_definition:
    :return:
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.deregister_job_definition(job_definition)
示例#6
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)
示例#7
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)
示例#8
0
def destroy(ctx, queue):
    """
    Destroy an existing queue.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.disable_queue(queue)
    time.sleep(1)
    mgr.destroy_queue(queue)
示例#9
0
def destroy(ctx, compute_environment):
    """
    Destroy an existing compute environment.
    """

    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.disable_compute_environment(compute_environment)
    time.sleep(1)
    mgr.destroy_compute_environment(compute_environment)
示例#10
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)
示例#11
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)
示例#12
0
def create(ctx, job_definition):
    """
    Create a new job definition.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    mgr.create_job_definition(job_definition)
示例#13
0
def disable(ctx, queue):
    """
    Disable an existing queue.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.disable_queue(queue)
示例#14
0
def update(ctx, queue):
    """
    Update an existing queue.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.update_queue(queue)
示例#15
0
def create(ctx, queue):
    """
    Create a new queue.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.create_queue(queue)
示例#16
0
def info(ctx):
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    lines = mgr.describe()
    for line in lines:
        click.echo(line)
示例#17
0
def update(ctx, job_definition):
    """
    Update an existing job definition.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    mgr.update_job_definition(job_definition)
示例#18
0
def disable(ctx, compute_environment):
    """
    Disable an existing compute environment.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.disable_compute_environment(compute_environment)
示例#19
0
def info(ctx):
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    lines = mgr.describe()
    for line in lines:
        click.echo(line)
示例#20
0
def update(ctx, job_definition):
    """
    Update an existing job definition.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.update_job_definition(job_definition)
示例#21
0
def create(ctx, job_definition):
    """
    Create a new job definition.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.create_job_definition(job_definition)
示例#22
0
def update(ctx, queue):
    """
    Update an existing queue.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    mgr.update_queue(queue)
示例#23
0
def retry(ctx, queue):
    """
    Retry all failed jobs.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    mgr.retry_failed_jobs(queue)
示例#24
0
def disable(ctx, queue):
    """
    Disable an existing queue.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    mgr.disable_queue(queue)
示例#25
0
def create(ctx, compute_environment):
    """
    Create a new compute environment.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.create_compute_environment(compute_environment)
示例#26
0
def create(ctx, queue):
    """
    Create a new queue.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    mgr.create_queue(queue)
示例#27
0
def update(ctx, compute_environment):
    """
    Update an existing compute environment.
    """
    mgr = BatchManager(yml=ctx.obj['CONFIG'])
    mgr.update_compute_environment(compute_environment)
示例#28
0
def create(ctx, compute_environment):
    """
    Create a new compute environment.
    """
    mgr = BatchManager(filename=ctx.obj['CONFIG_FILE'])
    mgr.create_compute_environment(compute_environment)