dstack is an open-source alternative to Kubernetes, designed to simplify development, training, and deployment of AI across any cloud or on-prem. It supports NVIDIA, AMD, and TPU.
env setting in task/service/dev-environment configurations has two formats, it's either a list of strings or a mapping. When the list format is used, it's possible to specify a variable without value, in this case the value must be provided via a CLI argument or an enviroment variable:
env:
- REQUIRED_VAR
- VAR_WITH_EMPTY_VALUE=
$ dstack apply
Environment variable REQUIRED_VAR is not set
$ dstack apply -e REQUIRED_VAR=value
...
Submit a new run? [y/n]
$ export REQUIRED_VAR=value
$ dstack apply
...
Submit a new run? [y/n]
This is not possible with the mapping format:
env:
REQUIRED_VAR:
VAR_WITH_EMPTY_VALUE: ''
$ dstack apply
2 validation errors for ApplyConfigurationRequest
__root__ -> TaskConfigurationRequest -> env
value is not a valid list (type=type_error.list)
__root__ -> TaskConfigurationRequest -> env -> REQUIRED_VAR
none is not an allowed value (type=type_error.none.not_allowed)
Solution
Treat null (an implicit value in YAML mapping if no value provided) as a marker of a required variable.
Workaround
No response
Would you like to help us implement this feature by sending a PR?
Problem
env
setting in task/service/dev-environment configurations has two formats, it's either a list of strings or a mapping. When the list format is used, it's possible to specify a variable without value, in this case the value must be provided via a CLI argument or an enviroment variable:This is not possible with the mapping format:
Solution
Treat
null
(an implicit value in YAML mapping if no value provided) as a marker of a required variable.Workaround
No response
Would you like to help us implement this feature by sending a PR?
No