def get_pipeline(run_id, namespace=None): """Get Pipeline status :param run_id: id of pipelines run :param namespace: k8s namespace if not default :return: kfp run dict """ namespace = namespace or mlconf.namespace remote = not get_k8s_helper( silent=True).is_running_inside_kubernetes_cluster() if remote: mldb = get_run_db() if mldb.kind != "http": raise ValueError( "get pipeline require access to remote api-service" ", please set the dbpath url") resp = mldb.get_pipeline(run_id, namespace=namespace) else: client = Client(namespace=namespace) resp = client.get_run(run_id) if resp: resp = resp.to_dict() return resp
def _mock_get_run( kfp_client_mock: kfp.Client, api_run_detail: kfp_server_api.models.api_run_detail.ApiRunDetail, ): def get_run_mock(*args, **kwargs): return api_run_detail kfp_client_mock.get_run = get_run_mock
def get_pipline(run_id, wait=0, namespace=None): """Get or wait for Pipeline status, wait time in sec""" client = Client(namespace=namespace or mlconf.namespace) if wait: resp = client.wait_for_run_completion(run_id, wait) else: resp = client.get_run(run_id) return resp
def get_pipeline( run_id, namespace=None, format_: Union[str, mlrun.api.schemas.PipelinesFormat] = mlrun.api.schemas. PipelinesFormat.summary, project: str = None, remote: bool = True, ): """Get Pipeline status :param run_id: id of pipelines run :param namespace: k8s namespace if not default :param format_: Format of the results. Possible values are: - ``summary`` (default value) - Return summary of the object data. - ``full`` - Return full pipeline object. :param project: the project of the pipeline run :param remote: read kfp data from mlrun service (default=True) :return: kfp run dict """ namespace = namespace or mlconf.namespace if remote: mldb = get_run_db() if mldb.kind != "http": raise ValueError( "get pipeline require access to remote api-service" ", please set the dbpath url") resp = mldb.get_pipeline(run_id, namespace=namespace, format_=format_, project=project) else: client = Client(namespace=namespace) resp = client.get_run(run_id) if resp: resp = resp.to_dict() if (not format_ or format_ == mlrun.api.schemas.PipelinesFormat.summary.value): resp = format_summary_from_kfp_run(resp) show_kfp_run(resp) return resp