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()
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()
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)
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)
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)
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)
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)
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)
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)
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)
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)
def create(ctx, job_definition): """ Create a new job definition. """ mgr = BatchManager(filename=ctx.obj['CONFIG_FILE']) mgr.create_job_definition(job_definition)
def disable(ctx, queue): """ Disable an existing queue. """ mgr = BatchManager(yml=ctx.obj['CONFIG']) mgr.disable_queue(queue)
def update(ctx, queue): """ Update an existing queue. """ mgr = BatchManager(yml=ctx.obj['CONFIG']) mgr.update_queue(queue)
def create(ctx, queue): """ Create a new queue. """ mgr = BatchManager(yml=ctx.obj['CONFIG']) mgr.create_queue(queue)
def info(ctx): mgr = BatchManager(filename=ctx.obj['CONFIG_FILE']) lines = mgr.describe() for line in lines: click.echo(line)
def update(ctx, job_definition): """ Update an existing job definition. """ mgr = BatchManager(filename=ctx.obj['CONFIG_FILE']) mgr.update_job_definition(job_definition)
def disable(ctx, compute_environment): """ Disable an existing compute environment. """ mgr = BatchManager(yml=ctx.obj['CONFIG']) mgr.disable_compute_environment(compute_environment)
def info(ctx): mgr = BatchManager(yml=ctx.obj['CONFIG']) lines = mgr.describe() for line in lines: click.echo(line)
def update(ctx, job_definition): """ Update an existing job definition. """ mgr = BatchManager(yml=ctx.obj['CONFIG']) mgr.update_job_definition(job_definition)
def create(ctx, job_definition): """ Create a new job definition. """ mgr = BatchManager(yml=ctx.obj['CONFIG']) mgr.create_job_definition(job_definition)
def update(ctx, queue): """ Update an existing queue. """ mgr = BatchManager(filename=ctx.obj['CONFIG_FILE']) mgr.update_queue(queue)
def retry(ctx, queue): """ Retry all failed jobs. """ mgr = BatchManager(filename=ctx.obj['CONFIG_FILE']) mgr.retry_failed_jobs(queue)
def disable(ctx, queue): """ Disable an existing queue. """ mgr = BatchManager(filename=ctx.obj['CONFIG_FILE']) mgr.disable_queue(queue)
def create(ctx, compute_environment): """ Create a new compute environment. """ mgr = BatchManager(yml=ctx.obj['CONFIG']) mgr.create_compute_environment(compute_environment)
def create(ctx, queue): """ Create a new queue. """ mgr = BatchManager(filename=ctx.obj['CONFIG_FILE']) mgr.create_queue(queue)
def update(ctx, compute_environment): """ Update an existing compute environment. """ mgr = BatchManager(yml=ctx.obj['CONFIG']) mgr.update_compute_environment(compute_environment)
def create(ctx, compute_environment): """ Create a new compute environment. """ mgr = BatchManager(filename=ctx.obj['CONFIG_FILE']) mgr.create_compute_environment(compute_environment)