Skip to content

Commit

Permalink
skip optimization for sky jobs launch --yes
Browse files Browse the repository at this point in the history
The only reason we call optimize for jobs_launch is to give a preview of the
resources we expect to use, and give the user an opportunity to back out if it's
not what they expect. If you use --yes or -y, you don't have a chance to back
out and you're probably running from a script, where you don't care.
Optimization can take ~2 seconds, so just skip it.
  • Loading branch information
cg505 committed Nov 12, 2024
1 parent 930a9a1 commit 5d61df5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sky/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3687,11 +3687,17 @@ def jobs_launch(
dag_utils.maybe_infer_and_fill_dag_and_task_names(dag)
dag_utils.fill_default_config_in_dag_for_job_launch(dag)

click.secho(f'Managed job {dag.name!r} will be launched on (estimated):',
fg='cyan')
dag, _ = admin_policy_utils.apply(
dag, use_mutated_config_in_current_request=False)
dag = sky.optimize(dag)

if not yes:
# Skip resource preview if -y is set, since we are probably running in
# a script and the user won't have a chance to review it anyway.
# This can save a couple of seconds.
click.secho(
f'Managed job {dag.name!r} will be launched on (estimated):',
fg='cyan')
dag = sky.optimize(dag)

if not yes:
prompt = f'Launching a managed job {dag.name!r}. Proceed?'
Expand Down

0 comments on commit 5d61df5

Please sign in to comment.