Ejemplo n.º 1
0
def _print_pipeline_versions(versions: List[kfp_server_api.ApiPipelineVersion],
                             output_format: OutputFormat):
    headers = ["Version ID", "Version name", "Uploaded at", "Pipeline ID"]
    data = [[
        version.id, version.name,
        version.created_at.isoformat(),
        next(rr for rr in version.resource_references
             if rr.key.type == kfp_server_api.ApiResourceType.PIPELINE).key.id
    ] for version in versions]
    print_output(data, headers, output_format, table_format="grid")
Ejemplo n.º 2
0
def _print_runs(runs: List[kfp_server_api.ApiRun],
                output_format: OutputFormat):
    headers = ['run id', 'name', 'status', 'created at', 'experiment id']
    data = [[
        run.id, run.name, run.status,
        run.created_at.isoformat(),
        next(
            rr for rr in run.resource_references
            if rr.key.type == kfp_server_api.ApiResourceType.EXPERIMENT).key.id
    ] for run in runs]
    print_output(data, headers, output_format, table_format='grid')
Ejemplo n.º 3
0
def _display_pipeline(pipeline: kfp_server_api.ApiPipeline,
                      output_format: OutputFormat):
    # Pipeline information
    table = [["Pipeline ID", pipeline.id], ["Name", pipeline.name],
             ["Description", pipeline.description],
             ["Uploaded at", pipeline.created_at.isoformat()],
             ["Version ID", pipeline.default_version.id]]

    # Pipeline parameter details
    headers = ["Parameter Name", "Default Value"]
    data = []
    if pipeline.parameters is not None:
        data = [[param.name, param.value] for param in pipeline.parameters]

    if output_format == OutputFormat.table.name:
        print_output([], ["Pipeline Details"], output_format)
        print_output(table, [], output_format, table_format="plain")
        print_output(data, headers, output_format, table_format="grid")
    elif output_format == OutputFormat.json.name:
        output = dict()
        output["Pipeline Details"] = dict(table)
        params = []
        for item in data:
            params.append(dict(zip(headers, item)))
        output["Pipeline Parameters"] = params
        print_output(output, [], output_format)
Ejemplo n.º 4
0
def _display_recurring_run(recurring_run: kfp_server_api.ApiJob,
                           output_format: OutputFormat):
    table = [
        ["Recurring Run ID", recurring_run.id],
        ["Name", recurring_run.name],
    ]
    if output_format == OutputFormat.table.name:
        print_output([], ["Recurring Run Details"], output_format)
        print_output(table, [], output_format, table_format="plain")
    elif output_format == OutputFormat.json.name:
        print_output(dict(table), [], output_format)
Ejemplo n.º 5
0
def _display_experiment(exp: kfp_server_api.ApiExperiment,
                        output_format: OutputFormat):
    table = [
        ["ID", exp.id],
        ["Name", exp.name],
        ["Description", exp.description],
        ["Created at", exp.created_at.isoformat()],
    ]
    if output_format == OutputFormat.table.name:
        print_output([], ["Experiment Details"], output_format)
        print_output(table, [], output_format, table_format="plain")
    elif output_format == OutputFormat.json.name:
        print_output(dict(table), [], output_format)
Ejemplo n.º 6
0
def _display_pipeline_version(version: kfp_server_api.ApiPipelineVersion,
                              output_format: OutputFormat):
    pipeline_id = next(
        rr for rr in version.resource_references
        if rr.key.type == kfp_server_api.ApiResourceType.PIPELINE).key.id
    table = [["Pipeline ID", pipeline_id], ["Version name", version.name],
             ["Uploaded at", version.created_at.isoformat()],
             ["Version ID", version.id]]

    if output_format == OutputFormat.table.name:
        print_output([], ["Pipeline Version Details"], output_format)
        print_output(table, [], output_format, table_format="plain")
    elif output_format == OutputFormat.json.name:
        print_output(dict(table), [], output_format)
Ejemplo n.º 7
0
def _print_pipelines(pipelines: List[kfp_server_api.ApiPipeline],
                     output_format: OutputFormat):
    headers = ["Pipeline ID", "Name", "Uploaded at"]
    data = [[pipeline.id, pipeline.name,
             pipeline.created_at.isoformat()] for pipeline in pipelines]
    print_output(data, headers, output_format, table_format="grid")
Ejemplo n.º 8
0
def _display_experiments(experiments: List[ApiExperiment],
                         output_format: OutputFormat):
    headers = ["Experiment ID", "Name", "Created at"]
    data = [[exp.id, exp.name, exp.created_at.isoformat()]
            for exp in experiments]
    print_output(data, headers, output_format, table_format="grid")
Ejemplo n.º 9
0
def _display_recurring_runs(recurring_runs: List[kfp_server_api.ApiJob],
                            output_format: OutputFormat):
    headers = ["Recurring Run ID", "Name"]
    data = [[rr.id, rr.name] for rr in recurring_runs]
    print_output(data, headers, output_format, table_format="grid")