-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dagster-airlift] Fix materialization reporting order for tasks #23326
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,14 @@ auth_backend = airflow.api.auth.backend.basic_auth | |
[webserver] | ||
expose_config = True | ||
|
||
EOL | ||
EOL | ||
|
||
# call airflow command to create the default user | ||
airflow db migrate && \ | ||
airflow users create \ | ||
--username admin \ | ||
--password admin \ | ||
--firstname Peter \ | ||
--lastname Parker \ | ||
--role Admin \ | ||
--email [email protected] |
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 @@ | ||
pytest_plugins = ["dagster_airlift.shared_fixtures"] |
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
43 changes: 43 additions & 0 deletions
43
examples/experimental/dagster-airlift/dagster_airlift/shared_fixtures.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,43 @@ | ||
import os | ||
import signal | ||
import subprocess | ||
import time | ||
from typing import Any, Generator | ||
|
||
import pytest | ||
import requests | ||
from dagster._time import get_current_timestamp | ||
|
||
|
||
def airflow_is_ready(): | ||
try: | ||
response = requests.get("http://localhost:8080") | ||
return response.status_code == 200 | ||
except: | ||
return False | ||
|
||
|
||
# Setup should have set AIRFLOW_HOME env var | ||
@pytest.fixture(name="airflow_instance") | ||
def airflow_instance_fixture(setup: None) -> Generator[Any, None, None]: | ||
process = subprocess.Popen( | ||
["airflow", "standalone"], | ||
env=os.environ, # since we have some temp vars in the env right now | ||
shell=False, | ||
preexec_fn=os.setsid, # noqa # fuck it we ball | ||
) | ||
# Give airflow a second to stand up | ||
time.sleep(5) | ||
initial_time = get_current_timestamp() | ||
|
||
airflow_ready = False | ||
while get_current_timestamp() - initial_time < 30: | ||
if airflow_is_ready(): | ||
airflow_ready = True | ||
break | ||
time.sleep(1) | ||
|
||
assert airflow_ready, "Airflow did not start within 30 seconds..." | ||
yield process | ||
# Kill process group, since process.kill and process.terminate do not work. | ||
os.killpg(process.pid, signal.SIGKILL) |
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
55 changes: 7 additions & 48 deletions
55
examples/experimental/dagster-airlift/dagster_airlift_tests/conftest.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 |
---|---|---|
@@ -1,65 +1,24 @@ | ||
import os | ||
import signal | ||
import subprocess | ||
from tempfile import TemporaryDirectory | ||
from typing import Any, Generator | ||
from typing import Generator | ||
|
||
import pytest | ||
from dagster._core.test_utils import environ | ||
|
||
|
||
@pytest.fixture(name="airflow_home_dir") | ||
def airflow_home_dir_fixture() -> Generator[str, None, None]: | ||
@pytest.fixture(name="setup") | ||
def setup_fixture() -> Generator[str, None, None]: | ||
with TemporaryDirectory() as tmpdir: | ||
# run chmod +x create_airflow_cfg.sh and then run create_airflow_cfg.sh tmpdir | ||
temp_env = {**os.environ.copy(), "AIRFLOW_HOME": tmpdir} | ||
# go up one directory from current | ||
path_to_script = os.path.join(os.path.dirname(__file__), "..", "create_airflow_cfg.sh") | ||
path_to_script = os.path.join(os.path.dirname(__file__), "..", "airflow_setup.sh") | ||
path_to_dags = os.path.join(os.path.dirname(__file__), "airflow_project", "dags") | ||
subprocess.run(["chmod", "+x", path_to_script], check=True, env=temp_env) | ||
subprocess.run([path_to_script, path_to_dags], check=True, env=temp_env) | ||
yield tmpdir | ||
|
||
|
||
@pytest.fixture(name="airflow_instance") | ||
def airflow_instance_fixture(airflow_home_dir: str) -> Generator[Any, None, None]: | ||
temp_env = {**os.environ.copy(), "AIRFLOW_HOME": airflow_home_dir} | ||
subprocess.run(["airflow", "db", "migrate"], check=True, env=temp_env) | ||
subprocess.run( | ||
[ | ||
"airflow", | ||
"users", | ||
"create", | ||
"--username", | ||
"admin", | ||
"--firstname", | ||
"admin", | ||
"--lastname", | ||
"admin", | ||
"--role", | ||
"Admin", | ||
"--email", | ||
"[email protected]", | ||
"--password", | ||
"admin", | ||
], | ||
check=True, | ||
env=temp_env, | ||
) | ||
process = subprocess.Popen( | ||
["airflow", "standalone"], | ||
env=temp_env, | ||
shell=False, | ||
stdout=subprocess.PIPE, | ||
preexec_fn=os.setsid, # noqa # fuck it we ball | ||
) | ||
assert process.stdout is not None | ||
for line in process.stdout: | ||
if "Airflow is ready" in line.decode(): | ||
break | ||
yield process | ||
# Kill process group, since process.kill and process.terminate do not work. | ||
os.killpg(process.pid, signal.SIGKILL) | ||
process.wait() | ||
with environ({"AIRFLOW_HOME": tmpdir}): | ||
yield tmpdir | ||
|
||
|
||
@pytest.fixture(name="dbt_project_dir") | ||
|
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
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 |
---|---|---|
|
@@ -27,16 +27,8 @@ setup_local_env: | |
make wipe && \ | ||
mkdir -p $$AIRFLOW_HOME && \ | ||
mkdir -p $$DAGSTER_HOME && \ | ||
chmod +x ../../create_airflow_cfg.sh && \ | ||
../../create_airflow_cfg.sh $(MAKEFILE_DIR)/peering_with_dbt/airflow_dags && \ | ||
airflow db migrate && \ | ||
airflow users create \ | ||
--username admin \ | ||
--password admin \ | ||
--firstname Peter \ | ||
--lastname Parker \ | ||
--role Admin \ | ||
--email [email protected] && \ | ||
chmod +x ../../airflow_setup.sh && \ | ||
../../airflow_setup.sh $(MAKEFILE_DIR)/peering_with_dbt/airflow_dags && \ | ||
make dbt_setup | ||
|
||
run_airflow: | ||
|
1 change: 1 addition & 0 deletions
1
examples/experimental/dagster-airlift/examples/peering-with-dbt/conftest.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 @@ | ||
pytest_plugins = ["dagster_airlift.shared_fixtures"] |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider "Event Creation Timestamp"