コード例 #1
0
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)
コード例 #2
0
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)
コード例 #3
0
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)
コード例 #4
0
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)
コード例 #5
0
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)
コード例 #6
0
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)
コード例 #7
0
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)
コード例 #8
0
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)