How to submit local jobs with dsl.pipeline

490 Views Asked by At

Trying to run and debug a pipeline locally. Pipeline is imeplemented with azure.ml.component.dsl.pipeline. When I try to set default_compute_target='local', the compute target cannot be found:

local not found in workspace, assume this is an AmlCompute
...
File "/home/amirabdi/miniconda3/envs/stm/lib/python3.8/site-packages/azure/ml/component/run_settings.py", line 596, in _get_compute_type
    raise InvalidTargetSpecifiedError(message="Cannot find compute '{}' in workspace.".format(compute_name))
azure.ml.component._util._exceptions.InvalidTargetSpecifiedError: InvalidTargetSpecifiedError:
        Message: Cannot find compute 'local' in workspace.
        InnerException None
        ErrorResponse
{
    "error": {
        "code": "UserError",
        "message": "Cannot find compute 'local' in workspace."
    }
}

The local run, for example, can be achieved with azureml.core.ScriptRunConfig.

src = ScriptRunConfig(script="train.py", compute_target="local", environment=myenv)
run = exp.submit(src)
1

There are 1 best solutions below

2
On

We have different types of compute targets and one of those is local computer.

  1. Create an experiment

    from azureml.core import Experiment

    experiment_name = 'my_experiment'

    experiment = Experiment(workspace=ws, name=experiment_name)

  2. Select the compute target where we need to run

    compute_target='local'

  3. If the compute_target is not mentioned or ScriptRunConfig is not mentioned, then AzureML will run the script locally

    from azureml.core import Environment

    myenv = Environment("user-managed-env")

    myenv.python.user_managed_dependencies = True

  4. Create the script job, based on the procedure mentioned in link

  5. Submit the experiment

run = experiment.submit(config=src)

run.wait_for_completion(show_output=True)

  1. To check for the troubleshooting the procedure, check with link