-
Notifications
You must be signed in to change notification settings - Fork 205
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Steps to reproduce
- Apply a dev env with negative
max_duration:
type: dev-environment
ide: vscode
max_duration: -10
- Get a CLI error:
✗ dstack apply -b gcp
Traceback (most recent call last):
File "/Users/r4victor/Projects/dstack/dstack/.venv/bin/dstack", line 10, in <module>
sys.exit(main())
^^^^^^
File "/Users/r4victor/Projects/dstack/dstack/src/dstack/_internal/cli/main.py", line 91, in main
args.func(args)
File "/Users/r4victor/Projects/dstack/dstack/src/dstack/_internal/cli/commands/apply.py", line 92, in _command
configurator.apply_configuration(
File "/Users/r4victor/Projects/dstack/dstack/src/dstack/_internal/cli/services/configurators/run.py", line 151, in apply_configuration
print_run_plan(run_plan, max_offers=configurator_args.max_offers)
File "/Users/r4victor/Projects/dstack/dstack/src/dstack/_internal/cli/utils/run.py", line 78, in print_run_plan
format_pretty_duration(job_plan.job_spec.max_duration)
File "/Users/r4victor/Projects/dstack/dstack/src/dstack/_internal/utils/common.py", line 192, in format_pretty_duration
raise ValueError("Seconds cannot be negative")
ValueError: Seconds cannot be negative
Actual behaviour
dstack does not check for negative duration but they are not expected so this leads to errors. This applies to max_duration, stop_duration, inactivity_duration. The idle_duration property is different since it accepts negative values as idle_duration: off.
Related to #3125
Expected behaviour
Forbid negative durations and accept off to turn durations off. Accept negative values in idle_duration for backward compatibility.
dstack version
master
Server logs
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working