次の方法で共有


PortDataReference クラス

完了した StepRun の出力に関連付けられたデータをモデル化します。

PortDataReference オブジェクトを使用して、StepRun によって生成された出力データをダウンロードできます。 これは、後のパイプラインでステップ入力として使用することもできます。

PortDataReference を初期化します。

継承
builtins.object
PortDataReference

コンストラクター

PortDataReference(context, pipeline_run_id, data_reference, step_run=None)

パラメーター

名前 説明
context
必須
<xref:azureml.pipeline.core._GraphContext>

グラフ コンテキスト オブジェクト。

pipeline_run_id
必須
str

出力を生成したパイプライン実行の ID。

data_reference
必須

データ参照オブジェクト。

step_run

データを生成した StepRun オブジェクト。

既定値: None
context
必須
<xref:azureml.pipeline.core._GraphContext>

グラフ コンテキスト オブジェクト。

pipeline_run_id
必須
str

出力を生成したパイプライン実行の ID。

data_reference
必須

データ参照オブジェクト。

step_run
必須

データを生成した StepRun オブジェクト。

注釈

PortDataReference では、完了した StepRun によって生成されたデータを指します。

PipelineRun から PortDataReference を取得し、次のように出力データをダウンロードします。


   from azureml.pipeline.core import PipelineRun, StepRun, PortDataReference

   pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
   step_run = pipeline_run.find_step_run("<node_name>")[0]
   port_data_reference = step_run.get_output_data("<output_name>")
   port_data_reference.download(local_path="path")

PortDataReference は、Pipeline の使用と同様に、DataReference のステップへの入力として使用できます。

ステップ入力として PortDataReference を使用する例を次に示します。


   from azureml.pipeline.core import PortDataReference, Pipeline, PipelineRun
   from azureml.pipeline.steps import PythonScriptStep

   pipeline_run = PipelineRun(experiment, "<pipeline_run_id>")
   step_run = pipeline_run.find_step_run("<node_name>")[0]
   port_data_reference = step_run.get_output_data("<output_name>")

   step_1 = PythonScriptStep(
       name='train',
       script_name="train.py",
       compute_target=compute,
       arguments=["--input", port_data_reference],
       inputs=[port_data_reference]
   )

   pipeline = Pipeline(workspace=workspace, steps=[step_1])

この例では、新しく構築されたパイプラインでは、トレーニング ステップへの入力として、完了した PipelineRun によって作成された出力が使用されます。

メソッド

as_download

"ダウンロード" モードでのステップ入力として PortDataReference を使用します。

as_input

InputPortBinding を作成し、入力名を指定します (ただし、既定のモードを使用)。

as_mount

"マウント" モードでのステップ入力として PortDataReference を使用します。

create_input_binding

この PortDataReference をソースとする入力バインディングを作成します。

download

PortDataReference によって表されるデータをダウンロードします。

as_download

"ダウンロード" モードでのステップ入力として PortDataReference を使用します。

as_download(input_name=None, path_on_compute=None, overwrite=None)

パラメーター

名前 説明
input_name
str

この入力の名前を指定します。

既定値: None
path_on_compute
str

データのダウンロード先となるコンピューティングのパス。

既定値: None
overwrite

既存のデータを上書きするかどうかを示すために使用します。

既定値: None

戻り値

説明

この PortDataReference をソースとする InputPortBinding。

as_input

InputPortBinding を作成し、入力名を指定します (ただし、既定のモードを使用)。

as_input(input_name)

パラメーター

名前 説明
input_name
必須
str

この入力の名前を指定するために使用します。

戻り値

説明

この PortDataReference をソースとする InputPortBinding。

as_mount

"マウント" モードでのステップ入力として PortDataReference を使用します。

as_mount(input_name=None)

パラメーター

名前 説明
input_name
str

この入力の名前を指定するために使用します。

既定値: None

戻り値

説明

この PortDataReference をソースとする InputPortBinding。

create_input_binding

この PortDataReference をソースとする入力バインディングを作成します。

create_input_binding(input_name=None, mode=None, path_on_compute=None, overwrite=None)

パラメーター

名前 説明
input_name
str

入力の名前。

既定値: None
mode
str

PortDataReference にアクセスするモード ("マウント" または "ダウンロード")。

既定値: None
path_on_compute
str

"ダウンロード" モードの場合は、データが格納されるコンピューティング上のパス。

既定値: None
overwrite

"ダウンロード" モードの場合は、既存のデータを上書きするかどうか。

既定値: None

戻り値

説明

この PortDataReference をソースとする InputPortBinding。

download

PortDataReference によって表されるデータをダウンロードします。

download(local_path, overwrite=None, show_progress=None)

パラメーター

名前 説明
local_path
必須
str

ダウンロード先のローカル パス。

overwrite

True の場合、既存のファイルを上書きします。既定値は False です。

既定値: None
show_progress

コンソールにダウンロードの進行状況を表示します。既定値は True です。

既定値: None

戻り値

説明
int

正常にダウンロードされたファイルの数。

属性

datastore

PortDataReference に関連付けられているデータストアを取得します。

戻り値

説明

データストア オブジェクト。

datastore_name

PortDataReference に関連付けられているデータストア名を取得します。

戻り値

説明
str

データストア名。

name

このデータ参照の名前を取得します。

戻り値

説明
str

データ参照名。

path_on_datastore

PortDataReference のデータストア上のパスを取得します。

戻り値

説明
str

データストア上のパス。