def job_delete(ctx, job_config, id): """Delete a cluster with the specified configuration name""" inputs = [ (ctx.credentials_file, "api/schema/credentials-schema.json", configurations.to_shipyard_credentials), (ctx.general_config_file, "api/schema/config-schema.json", configurations.to_shipyard_global_config), (job_config, "api/schema/job-config-schema.json", configurations.to_shipyard_job_config) ] config = configurations.get_merged_shipyard_config(inputs) job_api = JobApi(config) job_api.delete_job(id)
def cluster_delete(ctx, id): """Delete a cluster with the specified configuration name""" inputs = [ (ctx.credentials_file, "api/schema/credentials-schema.json", configurations.to_shipyard_credentials), (ctx.general_config_file, "api/schema/config-schema.json", configurations.to_shipyard_global_config), (cluster_config, "api/schema/cluster-config-schema.json", configurations.to_shipyard_pool_config) ] config = configurations.get_merged_shipyard_config(inputs) cluster_api = ClusterApi(config) cluster_api.delete_cluster(id)
def job_list(ctx): """List all jobs""" inputs = [ (ctx.credentials_file, "api/schema/credentials-schema.json", configurations.to_shipyard_credentials), (ctx.general_config_file, "api/schema/config-schema.json", configurations.to_shipyard_global_config) ] config = configurations.get_merged_shipyard_config(inputs) job_api = JobApi(config) jobs = job_api.list_jobs() for j in jobs: print(j.id)
def cluster_list(ctx): """List all clusters""" inputs = [ (ctx.credentials_file, "api/schema/credentials-schema.json", configurations.to_shipyard_credentials), (ctx.general_config_file, "api/schema/config-schema.json", configurations.to_shipyard_global_config) ] config = configurations.get_merged_shipyard_config(inputs) cluster_api = ClusterApi(config) clusters = cluster_api.list_clusters() for c in clusters: print(c.id)
def task_list(ctx, job_config, job_id): """List all tasks in the specified job""" inputs = [ (ctx.credentials_file, "api/schema/credentials-schema.json", configurations.to_shipyard_credentials), (ctx.general_config_file, "api/schema/config-schema.json", configurations.to_shipyard_global_config), (job_config, "api/schema/job-config-schema.json", configurations.to_shipyard_job_config) ] config = configurations.get_merged_shipyard_config(inputs) job_api = JobApi(config) tasks = job_api.list_tasks_for_job(job_id) for t in tasks: print(t.id)
def cluster_create(ctx, cluster_config, id, vm_count): """Create a cluster with the specified configuration file""" inputs = [ (ctx.credentials_file, "api/schema/credentials-schema.json", configurations.to_shipyard_credentials), (ctx.general_config_file, "api/schema/config-schema.json", configurations.to_shipyard_global_config), (cluster_config, "api/schema/cluster-config-schema.json", configurations.to_shipyard_pool_config) ] config = configurations.get_merged_shipyard_config(inputs) config["_verbose"] = ctx.verbose cluster_api = ClusterApi(config) cluster_api.create_cluster(id, vm_count)
def stream_file(ctx, job_config, job_id, task_id, cluster_config, cluster_id): """Stream the output file of the specified task""" inputs = [ (ctx.credentials_file, "api/schema/credentials-schema.json", configurations.to_shipyard_credentials), (ctx.general_config_file, "api/schema/config-schema.json", configurations.to_shipyard_global_config), (job_config, "api/schema/job-config-schema.json", configurations.to_shipyard_job_config), (cluster_config, "api/schema/cluster-config-schema.json", configurations.to_shipyard_pool_config) ] config = configurations.get_merged_shipyard_config(inputs) config["_verbose"] = ctx.verbose job_api = JobApi(config) job_api.stream_file(job_id, task_id, cluster_id)
def job_submit(ctx, job_config, cluster_config, id, cluster_id, recreate): """Submit a job to the specified cluster""" inputs = [ (ctx.credentials_file, "api/schema/credentials-schema.json", configurations.to_shipyard_credentials), (ctx.general_config_file, "api/schema/config-schema.json", configurations.to_shipyard_global_config), (job_config, "api/schema/job-config-schema.json", configurations.to_shipyard_job_config), (cluster_config, "api/schema/cluster-config-schema.json", configurations.to_shipyard_pool_config) ] config = configurations.get_merged_shipyard_config(inputs) config["_verbose"] = ctx.verbose job_api = JobApi(config) job_api.submit_job(id, cluster_id, recreate)