Skip to content

Commit

Permalink
dagster dev env var
Browse files Browse the repository at this point in the history
  • Loading branch information
alangenfeld committed Feb 21, 2024
1 parent 1e658bf commit 323c756
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from bar import foo_op # requires working_directory
from dagster import DefaultSensorStatus, RunRequest, job, repository, sensor

Expand Down Expand Up @@ -25,3 +27,7 @@ def example_repo():
@repository
def other_example_repo():
return [other_foo_job]


if os.getenv("CHECK_DAGSTER_DEV") and not os.getenv("DAGSTER_IS_DEV_CLI"):
raise Exception("DAGSTER_DEV env var not set")
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ def test_dagster_dev_command_workspace():
# and waits for a schedule run to launch
def test_dagster_dev_command_no_dagster_home():
with tempfile.TemporaryDirectory() as tempdir:
with environ({"DAGSTER_HOME": ""}):
with environ(
{
"DAGSTER_HOME": "", # unset dagster home
"CHECK_DAGSTER_DEV": "1", # trigger target user code to check for DAGSTER_DEV env var
}
):
with new_cwd(tempdir):
dagster_yaml = {
"run_coordinator": {
Expand Down Expand Up @@ -172,7 +177,6 @@ def test_dagster_dev_command_grpc_port():

client = DagsterGrpcClient(port=grpc_port, host="localhost")
wait_for_grpc_server(grpc_process, client, subprocess_args)

dev_process = subprocess.Popen(
[
"dagster",
Expand Down
2 changes: 2 additions & 0 deletions python_modules/dagster/dagster/_cli/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def dev_command(
' running "pip install dagster-webserver" in your Python environment.'
)

os.environ["DAGSTER_IS_DEV_CLI"] = "1"

configure_loggers(formatter=log_format, log_level=log_level.upper())
logger = logging.getLogger("dagster")

Expand Down

0 comments on commit 323c756

Please sign in to comment.