SweepJobLimits Class
Limits for Sweep Jobs.
- Inheritance
-
azure.ai.ml.entities._job.job_limits.JobLimitsSweepJobLimits
Constructor
SweepJobLimits(*, max_concurrent_trials: int | None = None, max_total_trials: int | None = None, timeout: int | None = None, trial_timeout: int | str | None = None)
Keyword-Only Parameters
Name | Description |
---|---|
max_concurrent_trials
|
The maximum number of concurrent trials for the Sweep Job. |
max_total_trials
|
The maximum number of total trials for the Sweep Job. |
timeout
|
The maximum run duration, in seconds, after which the job will be cancelled. |
trial_timeout
|
The timeout value, in seconds, for each Sweep Job trial. |
Examples
Assigning limits to a SweepJob
from azure.ai.ml.entities import CommandJob
from azure.ai.ml.sweep import BayesianSamplingAlgorithm, Objective, SweepJob, SweepJobLimits
command_job = CommandJob(
inputs=dict(kernel="linear", penalty=1.0),
compute=cpu_cluster,
environment=f"{job_env.name}:{job_env.version}",
code="./scripts",
command="python scripts/train.py --kernel $kernel --penalty $penalty",
experiment_name="sklearn-iris-flowers",
)
sweep = SweepJob(
sampling_algorithm=BayesianSamplingAlgorithm(),
trial=command_job,
search_space={"ss": Choice(type="choice", values=[{"space1": True}, {"space2": True}])},
inputs={"input1": {"file": "top_level.csv", "mode": "ro_mount"}},
compute="top_level",
limits=SweepJobLimits(trial_timeout=600),
objective=Objective(goal="maximize", primary_metric="accuracy"),
)
Attributes
timeout
The maximum run duration, in seconds, after which the job will be cancelled.
Returns
Type | Description |
---|---|
The maximum run duration, in seconds, after which the job will be cancelled. |
trial_timeout
The timeout value, in seconds, for each Sweep Job trial.
Returns
Type | Description |
---|---|
The timeout value, in seconds, for each Sweep Job trial. |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Azure SDK for Python