You have a train.py script that works locally. How do you run it on a compute cluster so the run is tracked and repeatable?
- Exam domain
- Implement machine learning model lifecycle and operations25–30% of the exam
- Difficulty
- Easy
- In this mock
- 22 questions on this domainPractise this domain
Why the exam asks this
Implement machine learning model lifecycle and operations: Orchestrate model training.
Objective in the exam guide: Run model training scripts.
Moving from a laptop script to tracked cloud runs is the first MLOps step. The exam checks you know the job type.
Why A is the answer
Submit a command job that sets the code folder, command, environment and compute
A command job packages the code, the command to run, the environment and the compute target, and records the run in the workspace.
How it works
A command job runs a command, such as python train.py, with your code folder on a compute target.
It specifies an environment, so dependencies are fixed.
The job records logs, outputs and metrics, so the run can be repeated and compared.
Clues in the question
The words that point to the answer, and what each one tells you.
- Works locally
- Code is ready; it needs a job.
- Tracked and repeatable
- A job, not an ad hoc run.
In detail
- Inputs such as data assets can be passed as job inputs.
- The job keeps logs, outputs and MLflow metrics.
Side by side with look-alikes
| Method | Tracked? | Uses a cluster? |
|---|---|---|
| Submit a command job | Yes | Yes |
| Terminal on compute instance | No | No |
| Online endpoint | Not training | No |
| Model description | No | No |
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. Submit a command job that sets the code folder, command, environment and computeRight
A command job packages the code, the command to run, the environment and the compute target, and records the run in the workspace.
B. Copy the script into a compute instance and run it in a terminalWrongMost tempting
A terminal run on one machine is not tracked as a job.
Why it tempts: It moves the work to the cloud, so it seems like progress. But it is still an untracked, one-off run on one machine.
C. Paste the script into a model descriptionWrong
A description stores text, not runnable code.
D. Deploy the script to an online endpointWrong
Endpoints serve predictions; they do not train.
In practice
- Define the job in a YAML file in Git and submit it with az ml job create, so the definition is versioned.