A8 - ML jobs

job

  • a defined piece of work submitted to Azure ML

from azure.ai.ml import command, Input

job = command(
    code="./src",   # directory containing the source code
    command="python train.py --data ${{inputs.data}} --max-depth 10",  # to execute after job env is running
    inputs={
        "data": Input(
            type="uri_folder",
            path="azureml:detector-data:5"
        )
    },
    environment="azureml:sklearn-env:3",
    compute="cpu-cluster"
)
inputs={
    "max_depth": 10
}

command="python train.py --max-depth ${{inputs.max_depth}}"
ml_client.jobs.create_or_update(job)
outputs={
    "model_output": ...
}
# use ${{outputs.model_output}} in command
$schema: ...
type: command

code: ./src

command: >
  python train.py
  --data ${{inputs.data}}

environment: azureml:sklearn-env:3
compute: azureml:cpu-cluster

inputs:
  data:
    type: uri_folder
    path: azureml:detector-data:5

command-job lifecycle.png|250