ScriptRunConfig class


Represents configuration information for submitting a training run in Azure Machine Learning.

A ScriptRunConfig packages together environment configuration of RunConfiguration with a script for training to create a script run. In most typical scenarios, you will create a ScriptRunConfig object and then access RunConfiguration with the get_run_config_from_script_run(script_run_config) function.

Once a script run is configured and submitted with the submit(config, tags=None, **kwargs) method or with the submit(script_run_config, workspace, experiment_name, run_id=None, _parent_run_id=None) function, a ScriptRun is returned.

For examples of run configurations, see Select and use a compute target to train your model.

ScriptRunConfig(source_directory, script=None, arguments=None, run_config=None, _telemetry_values=None)



The directory that contains the training script.


The name of the training script, for example ''.


Optional command line arguments to pass to the training script.


Optional run configuration to use.


Internal use only.


The Azure Machine Learning SDK provides you with a series of interconnected classes, that are designed to help you train and compare machine learning models that are related by the shared problem that they are solving.

An Experiment acts as a logical container for these training runs. A RunConfiguration object is used to codify the information necessary to submit a training run in an experiment. A ScriptRunConfig object is a helper class that packages the RunConfiguration object with an execution script for training.

A ScriptRunConfig object is used to submit a training run as part of an Experiment. When a training run is submitted using a ScriptRunConfig object, the submit method returns an object of type ScriptRun. The returned ScriptRun object gives you programmatic access to information about the training run. ScriptRun is a child class of Run.

The key concept to remember is that there are different configuration objects that are used to submit an experiment, based on what kind of run you want to trigger. The type of the configuration object then informs what child class of Run you get back from the submit method. When you pass a ScriptRunConfig object in a call to Experiment's submit method, you get back a ScriptRun object. Examples of other run objects returned include AutoMLRun (returned for an AutoML run) and PipelineRun (returned for a Pipeline run).

The following sample shows how to submit a training script on your local machine.

   from azureml.core import ScriptRunConfig, RunConfiguration, Experiment

   # create or load an experiment
   experiment = Experiment(workspace, "MyExperiment")
   # run a trial from the code in your current directory
   config = ScriptRunConfig(source_directory='.', script='',
   script_run = experiment.submit(config)

For more examples showing how to work with ScriptRunConfig, see: