共用方式為


PipelineRun 類別

表示的執行 Pipeline

此類別可用來管理、檢查狀態,以及提交管線執行之後擷取執行詳細數據。 使用 get_steps 來擷 StepRun 取管線執行所建立的物件。 其他用途包括擷 Graph 取與管線執行相關聯的物件、擷取管線執行的狀態,以及等候執行完成。

初始化管線執行。

建構函式

PipelineRun(experiment, run_id, _service_endpoint=None, **kwags)

參數

名稱 Description
experiment
必要

與管線執行相關聯的實驗物件。

run_id
必要
str

管線執行的執行標識碼。

_service_endpoint
str

要連接的端點。

預設值: None
experiment
必要

與管線執行相關聯的實驗物件。

run_id
必要
str

管線執行的執行標識碼。

_service_endpoint
必要
str

要連接的端點。

備註

透過Pipeline提交 submit 時,會傳回 PipelineRun 物件。 的 Experiment方法。 如需如何建立和提交管線的詳細資訊,請參閱: https://aka.ms/pl-first-pipeline

PipelineRun 也可以透過提交至 的執行具現化 Experiment ,以及 PipelineRun 識別符,如下所示:


   from azureml.core import Experiment
   from azureml.pipeline.core import PipelineRun

   experiment = Experiment(workspace, "<experiment_name>")
   pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")

使用 PipelineRun 時,請使用:

  • wait_for_completion 以監視執行狀態,並選擇性地串流執行記錄。

  • get_status 以擷取執行狀態。

  • cancel 表示取消進行中的 PipelineRun。

  • get_steps 以列出產生的 StepRuns。 PipelineRun 會產生 StepRun 管線中每個步驟的 。

方法

cancel

取消進行中的執行。

child_run

建立管線執行的子執行。 未針對 PipelineRun 實作這個方法。

complete

將管線執行標示為完成。 未針對 PipelineRun 實作這個方法。

管線不支援此方法;完成/失敗狀態是由 Azure ML 後端所管理。

fail

將管線執行標示為失敗。 未針對 PipelineRun 實作這個方法。

管線不支援此方法;完成/失敗狀態是由 Azure ML 後端所管理。

find_step_run

依名稱尋找管線中的步驟執行。

get

根據執行標識符擷取管線執行。

get_graph

取得管線執行的圖表。

get_pipeline_output

取得指定管線輸出的 PortDataReference。

get_pipeline_runs

擷取從已發佈管線產生的管線執行。

get_status

從服務擷取管線執行的最新狀態。

傳回的常見值包括 「Running」、“ Finished” 和 「Failed」。

get_steps

取得已完成或已開始執行之所有管線步驟的步驟執行。

get_tags

取得回合的標記集。

publish_pipeline

發佈管線,並讓它可供重新執行。

您可以從此函式所傳回的 PublishedPipeline 物件取得管線端點。 透過管線端點,您可以使用 REST 呼叫從外部應用程式叫用管線。 如需如何在呼叫 REST 端點時進行驗證的資訊,請參閱 https://aka.ms/pl-restep-auth

與管線執行相關聯的原始管線會作為已發佈管線的基底。

save

將管線 YAML 儲存至檔案。

wait_for_completion

等候此管線執行完成。

傳回等候之後的狀態。

cancel

取消進行中的執行。

cancel()

child_run

建立管線執行的子執行。 未針對 PipelineRun 實作這個方法。

child_run(name=None, run_id=None, outputs=None)

參數

名稱 Description
name
str

子系的選擇性名稱。

預設值: None
run_id
str

選擇性的子系執行標識碼,否則會使用預設值。

預設值: None
outputs
str

選擇性輸出要追蹤子系的目錄。

預設值: None

傳回

類型 Description
Run

子執行。

例外狀況

類型 Description

complete

將管線執行標示為完成。 未針對 PipelineRun 實作這個方法。

管線不支援此方法;完成/失敗狀態是由 Azure ML 後端所管理。

complete()

例外狀況

類型 Description

fail

將管線執行標示為失敗。 未針對 PipelineRun 實作這個方法。

管線不支援此方法;完成/失敗狀態是由 Azure ML 後端所管理。

fail()

例外狀況

類型 Description

find_step_run

依名稱尋找管線中的步驟執行。

find_step_run(name)

參數

名稱 Description
name
必要
str

要尋找的步驟名稱。

傳回

類型 Description

StepRun具有所提供名稱的物件清單。

get

根據執行標識符擷取管線執行。

static get(workspace, run_id, _service_endpoint=None)

參數

名稱 Description
workspace
必要

與管線相關聯的工作區。

run_id
必要
str

管線執行的識別碼。

_service_endpoint
str

要連接的端點。

預設值: None

傳回

類型 Description

PipelineRun 物件。

get_graph

取得管線執行的圖表。

get_graph()

傳回

類型 Description

圖形。

get_pipeline_output

取得指定管線輸出的 PortDataReference。

get_pipeline_output(pipeline_output_name)

參數

名稱 Description
pipeline_output_name
必要
str

要取得之管線輸出的名稱。

傳回

類型 Description

代表管線輸出數據的 PortDataReference。

get_pipeline_runs

擷取從已發佈管線產生的管線執行。

static get_pipeline_runs(workspace, pipeline_id, _service_endpoint=None)

參數

名稱 Description
workspace
必要

與管線相關聯的工作區。

pipeline_id
必要
str

已發佈管線的標識碼。

_service_endpoint
str

要連接的端點。

預設值: None

傳回

類型 Description

物件清單 PipelineRun

get_status

從服務擷取管線執行的最新狀態。

傳回的常見值包括 「Running」、“ Finished” 和 「Failed」。

get_status()

傳回

類型 Description
str

字串的最新狀態。

備註

  • NotStarted - 這是雲端提交之前,用戶端 Run 物件的暫存狀態

  • 執行 - 作業已開始在計算目標中執行。

  • 失敗 - 執行失敗。 執行上的 Error 屬性通常會提供原因的詳細數據。

  • 已完成 - 執行已順利完成。

  • 已取消 - 在取消要求之後,現在已成功取消執行。


   run = experiment.submit(config)
   while run.get_status() not in ['Finished', 'Failed']: # For example purposes only, not exhaustive
       print('Run {} not in terminal state'.format(run.id))
       time.sleep(10)

get_steps

取得已完成或已開始執行之所有管線步驟的步驟執行。

get_steps()

傳回

類型 Description

物件清單 StepRun

get_tags

取得回合的標記集。

get_tags()

傳回

類型 Description

執行標記的字典。

publish_pipeline

發佈管線,並讓它可供重新執行。

您可以從此函式所傳回的 PublishedPipeline 物件取得管線端點。 透過管線端點,您可以使用 REST 呼叫從外部應用程式叫用管線。 如需如何在呼叫 REST 端點時進行驗證的資訊,請參閱 https://aka.ms/pl-restep-auth

與管線執行相關聯的原始管線會作為已發佈管線的基底。

publish_pipeline(name, description, version, continue_on_step_failure=None, **kwargs)

參數

名稱 Description
name
必要
str

已發佈管線的名稱。

description
必要
str

已發行管線的描述。

version
必要
str

已發佈管線的版本。

continue_on_step_failure

如果步驟失敗,是否要繼續執行 PipelineRun 中的其他步驟。 預設值為 False。

預設值: None
kwargs
必要

自定義關鍵詞自變數,保留供未來開發使用

傳回

類型 Description

已建立已發佈的管線。

save

將管線 YAML 儲存至檔案。

save(path=None)

參數

名稱 Description
path
str

要儲存 YAML 的路徑。 如果路徑是目錄,管線 YAML 檔案會儲存在 <path>/pipeline.yml。 如果path為 none,則會使用目前的目錄。

預設值: None

傳回

類型 Description

wait_for_completion

等候此管線執行完成。

傳回等候之後的狀態。

wait_for_completion(show_output=True, timeout_seconds=9223372036854775807, raise_on_error=True)

參數

名稱 Description
show_output

指出是否要在 sys.stdout 上顯示管線執行狀態。

預設值: True
timeout_seconds
int

在逾時之前等候的秒數。

預設值: 9223372036854775807
raise_on_error

指出當執行處於失敗狀態時,是否引發錯誤。

預設值: True

傳回

類型 Description
str

最終狀態。