-
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.
gt sta[[docs] Add source control code references docs [0
- Loading branch information
Showing
8 changed files
with
188 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
25 changes: 25 additions & 0 deletions
25
...ples/docs_snippets/docs_snippets/guides/dagster/code_references/link_to_source_control.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,25 @@ | ||
from pathlib import Path | ||
|
||
from dagster import Definitions, asset | ||
from dagster._core.definitions.metadata import ( | ||
link_to_source_control, | ||
with_source_code_references, | ||
) | ||
|
||
|
||
@asset | ||
def my_asset(): ... | ||
|
||
|
||
@asset | ||
def another_asset(): ... | ||
|
||
|
||
defs = Definitions( | ||
assets=link_to_source_control( | ||
assets_defs=with_source_code_references([my_asset, another_asset]), | ||
source_control_url="https://github.com/dagster-io/dagster", | ||
source_control_branch="main", | ||
repository_root_absolute_path=Path(__file__).parent, | ||
) | ||
) |
30 changes: 30 additions & 0 deletions
30
...ippets/docs_snippets/guides/dagster/code_references/link_to_source_control_conditional.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,30 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from dagster import Definitions, asset | ||
from dagster._core.definitions.metadata import ( | ||
link_to_source_control, | ||
with_source_code_references, | ||
) | ||
|
||
|
||
@asset | ||
def my_asset(): ... | ||
|
||
|
||
@asset | ||
def another_asset(): ... | ||
|
||
|
||
assets = with_source_code_references([my_asset, another_asset]) | ||
|
||
defs = Definitions( | ||
assets=link_to_source_control( | ||
assets_defs=assets, | ||
source_control_url="https://github.com/dagster-io/dagster", | ||
source_control_branch="main", | ||
repository_root_absolute_path=Path(__file__).parent, | ||
) | ||
if bool(os.getenv("IS_PRODUCTION")) | ||
else assets | ||
) |
25 changes: 25 additions & 0 deletions
25
...docs_snippets/docs_snippets/guides/dagster/code_references/link_to_source_control_plus.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,25 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from dagster_cloud.metadata.source_code import link_to_git_if_cloud | ||
|
||
from dagster import Definitions, asset | ||
from dagster._core.definitions.metadata import with_source_code_references | ||
|
||
|
||
@asset | ||
def my_asset(): ... | ||
|
||
|
||
@asset | ||
def another_asset(): ... | ||
|
||
|
||
defs = Definitions( | ||
assets=link_to_git_if_cloud( | ||
assets_defs=with_source_code_references([my_asset, another_asset]), | ||
# Inferred from searching for .git directory in parent directories | ||
# of the module containing this code - may also be set explicitly | ||
repository_root_absolute_path=Path(__file__).parent, | ||
) | ||
) |
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