-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cli] Set
DAGSTER_IS_DEFS_VALIDATION_CLI
in `dagster definitions va…
…lidate` (#25624) ## Summary & Motivation Our design partners would like to have more control on the code and its behavior when in validation mode: different credentials, etc. This PR updates `dagster definitions validate` to set the env var `DAGSTER_IS_DEFS_VALIDATION_CLI` when the command is running , like we do so `DAGSTER_IS_DEV_CLI` and `dagster dev`. This will allow users to control the code using the env var like: ``` import os if os.getenv("DAGSTER_IS_DEFS_VALIDATION_CLI"): ... ``` ## How I Tested These Changes Additional unit test
- Loading branch information
1 parent
1b790db
commit 4270e2e
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...mmand_tests/definitions_command_projects/valid_project/valid_project/gated_definitions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
|
||
from dagster import Definitions, asset, define_asset_job | ||
|
||
if os.getenv("DAGSTER_IS_DEFS_VALIDATION_CLI"): | ||
|
||
@asset | ||
def my_gated_asset() -> None: ... | ||
|
||
my_gated_job = define_asset_job(name="my_gated_job", selection="my_gated_asset") | ||
|
||
defs = Definitions(assets=[my_gated_asset], jobs=[my_gated_job]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters