StepRun 類別
- 繼承
-
StepRun
建構函式
StepRun(experiment, step_run_id, pipeline_run_id, node_id, _service_endpoint=None, _is_reused=False, _current_node_id=None, _reused_run_id=None, _reused_node_id=None, _reused_pipeline_run_id=None, **kwargs)
參數
- _reused_run_id
- _reused_node_id
- str
- _reused_pipeline_run_id
- str
備註
StepRun 會建立為提交 PipelineRun 之 的子執行。 擷取 PipelineRun 中的所有 StepRuns,如下所示:
from azureml.core import Experiment
from azureml.pipeline.core import PipelineRun
experiment = Experiment(workspace, "<experiment_name>")
pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
step_runs = pipeline_run.get_steps()
用來 get_details_with_logs 擷取執行所建立的執行詳細資料和記錄。
StepRun 也可以用來下載執行的輸出。 使用 get_outputs 來擷取步驟輸出的聽寫,或使用 get_output 來擷取具有所提供名稱之輸出的單一 StepRunOutput 物件。 您也可以使用 get_output_data 來直接擷取 PortDataReference 指定步驟輸出的 。
下載步驟輸出的範例如下:
from azureml.pipeline.core import PipelineRun, StepRun, PortDataReference
pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
step_run = pipeline_run.find_step_run("<step_name>")[0]
port_data_reference = step_run.get_output_data("<output_name>")
port_data_reference.download(local_path="path")
方法
child_run |
步驟執行的子執行。 這個方法並未針對 StepRun 實作。 |
complete |
完成步驟執行。 這個方法並未針對 StepRun 實作。 |
fail |
步驟執行失敗。 這個方法並未針對 StepRun 實作。 |
get_details_with_logs |
使用記錄檔內容傳回執行的狀態詳細資料。 |
get_job_log |
傾印步驟執行的目前作業記錄檔。 |
get_output |
取得具有指定名稱的節點輸出。 |
get_output_data |
從指定的輸出取得輸出資料。 |
get_outputs |
取得步驟輸出。 |
get_status |
從服務擷取管線執行的最新狀態。 傳回的常見值包括 「Running」、「Finished」 和 「Failed」。 |
get_stderr_log |
傾印步驟執行的目前 stderr 記錄檔。 |
get_stdout_log |
傾印步驟執行的目前 stdout 記錄檔。 |
wait_for_completion |
等候此步驟執行完成。 傳回等候之後的狀態。 |
child_run
步驟執行的子執行。 這個方法並未針對 StepRun 實作。
child_run(name=None, run_id=None, outputs=None)
參數
傳回
子執行
傳回類型
例外狀況
complete
fail
get_details_with_logs
get_job_log
get_output
取得具有指定名稱的節點輸出。
get_output(name)
參數
傳回
具有指定名稱的 StepRunOutput。
傳回類型
例外狀況
get_output_data
從指定的輸出取得輸出資料。
get_output_data(name)
參數
傳回
代表步驟輸出資料的 PortDataReference。
傳回類型
例外狀況
get_outputs
get_status
從服務擷取管線執行的最新狀態。
傳回的常見值包括 「Running」、「Finished」 和 「Failed」。
get_status()
傳回
字串的最新狀態
傳回類型
例外狀況
備註
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_stderr_log
get_stdout_log
wait_for_completion
等候此步驟執行完成。
傳回等候之後的狀態。
wait_for_completion(show_output=True, timeout_seconds=9223372036854775807, raise_on_error=True)
參數
傳回
最終狀態。
傳回類型
例外狀況
屬性
pipeline_run_id
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應