RunFunction Class

Run Function.

Inheritance
azure.ai.ml.entities._job.parallel.parallel_task.ParallelTask
RunFunction

Constructor

RunFunction(*, code: str | None = None, entry_script: str | None = None, program_arguments: str | None = None, model: str | None = None, append_row_to: str | None = None, environment: Environment | str | None = None, **kwargs: Any)

Parameters

Name Description
code
Required
str

A local or remote path pointing at source code.

entry_script
Required
str

User script which will be run in parallel on multiple nodes. This is specified as a local file path. The entry_script should contain two functions: init(): this function should be used for any costly or common preparation for subsequent inferences, e.g., deserializing and loading the model into a global object. run(mini_batch): The method to be parallelized. Each invocation will have one mini-batch. 'mini_batch': Batch inference will invoke run method and pass either a list or a Pandas DataFrame as an argument to the method. Each entry in min_batch will be a filepath if input is a FileDataset, a Pandas DataFrame if input is a TabularDataset. run() method should return a Pandas DataFrame or an array. For append_row output_action, these returned elements are appended into the common output file. For summary_only, the contents of the elements are ignored. For all output actions, each returned output element indicates one successful inference of input element in the input mini-batch. Each parallel worker process will call init once and then loop over run function until all mini-batches are processed.

program_arguments
Required

The arguments of the parallel task.

model
Required
str

The model of the parallel task.

append_row_to
Required
str

All values output by run() method invocations will be aggregated into one unique file which is created in the output location. if it is not set, 'summary_only' would invoked, which means user script is expected to store the output itself.

environment
Required

Environment that training job will run in.

Keyword-Only Parameters

Name Description
code
Required
entry_script
Required
program_arguments
Required
model
Required
append_row_to
Required
environment
Required

Methods

get
has_key
items
keys
update
values

get

get(key: Any, default: Any | None = None) -> Any

Parameters

Name Description
key
Required
default
Default value: None

has_key

has_key(k: Any) -> bool

Parameters

Name Description
k
Required

items

items() -> list

keys

keys() -> list

update

update(*args: Any, **kwargs: Any) -> None

values

values() -> list