Skip to content
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

[components] Add *Component suffix to all component classes #28082

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ attributes:

By convention, most library components have an `execute()` method that defines the core runtime behavior of the component. This can be overridden by subclasses of the component to customize this behavior.

For example, we can create a subclass of the `SlingReplicationCollectioncomponent` that adds a debug log message during execution:
For example, we can create a subclass of the `SlingReplicationCollectionComponent` that adds a debug log message during execution:

<CodeExample path="docs_beta_snippets/docs_beta_snippets/guides/components/custom-subclass/debug-mode.py" language="python" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dagster_components.lib import SlingReplicationCollection
from dagster_components.lib import SlingReplicationCollectionComponent


class CustomSubclass(SlingReplicationCollection): ...
class CustomSubclass(SlingReplicationCollectionComponent): ...
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from collections.abc import Mapping
from typing import Any

from dagster_components.lib import SlingReplicationCollection
from dagster_components.lib import SlingReplicationCollectionComponent

import dagster as dg


class SubclassWithScope(SlingReplicationCollection):
class SubclassWithScope(SlingReplicationCollectionComponent):
def get_additional_scope(self) -> Mapping[str, Any]:
def _custom_cron(cron_schedule: str) -> dg.AutomationCondition:
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from collections.abc import Iterator

from dagster_components.lib import SlingReplicationCollection
from dagster_components.lib import SlingReplicationCollectionComponent
from dagster_sling import SlingResource

import dagster as dg


class DebugSlingReplicationComponent(SlingReplicationCollection):
class DebugSlingReplicationComponent(SlingReplicationCollectionComponent):
def execute(
self, context: dg.AssetExecutionContext, sling: SlingResource
) -> Iterator:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
dg list component-type

Using /.../my-existing-project/.venv/bin/dagster-components
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Component Type ┃ Summary ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ dagster_components.lib.DefinitionsComponent │ Wraps an arbitrary set of │
│ │ Dagster definitions. │
│ dagster_components.lib.PipesSubprocessScriptCollection │ Assets that wrap Python │
│ │ scripts executed with │
│ │ Dagster's │
│ │ PipesSubprocessClient. │
└────────────────────────────────────────────────────────┴───────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Component Type ┃ Summary ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ dagster_components.lib.DefinitionsComponent │ Wraps an arbitrary │
│ │ set of Dagster │
│ │ definitions. │
│ dagster_components.lib.PipesSubprocessScriptCollectionComponent │ Assets that wrap │
│ │ Python scripts │
│ │ executed with │
│ │ Dagster's │
│ │ PipesSubprocessClie… │
└─────────────────────────────────────────────────────────────────┴──────────────────────┘
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type: dagster_components.lib.SlingReplicationCollection
type: dagster_components.lib.SlingReplicationCollectionComponent

attributes:
replications:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
dg list component-type

Using /.../jaffle-platform/.venv/bin/dagster-components
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Component Type ┃ Summary ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ dagster_components.lib.DbtProjectComponent │ Expose a DBT project to │
│ │ Dagster as a set of assets. │
│ dagster_components.lib.DefinitionsComponent │ Wraps an arbitrary set of │
│ │ Dagster definitions. │
│ dagster_components.lib.PipesSubprocessScriptCollection │ Assets that wrap Python │
│ │ scripts executed with │
│ │ Dagster's │
│ │ PipesSubprocessClient. │
│ dagster_components.lib.SlingReplicationCollection │ Expose one or more Sling │
│ │ replications to Dagster as │
│ │ assets. │
└────────────────────────────────────────────────────────┴───────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Component Type ┃ Summary ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ dagster_components.lib.DbtProjectComponent │ Expose a DBT project │
│ │ to Dagster as a set │
│ │ of assets. │
│ dagster_components.lib.DefinitionsComponent │ Wraps an arbitrary │
│ │ set of Dagster │
│ │ definitions. │
│ dagster_components.lib.PipesSubprocessScriptCollectionComponent │ Assets that wrap │
│ │ Python scripts │
│ │ executed with │
│ │ Dagster's │
│ │ PipesSubprocessClie… │
│ dagster_components.lib.SlingReplicationCollectionComponent │ Expose one or more │
│ │ Sling replications │
│ │ to Dagster as │
│ │ assets. │
└─────────────────────────────────────────────────────────────────┴──────────────────────┘
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
dg list component-type

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Component Type ┃ Summary ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ dagster_components.lib.DefinitionsComponent │ Wraps an arbitrary set of │
│ │ Dagster definitions. │
│ dagster_components.lib.PipesSubprocessScriptCollection │ Assets that wrap Python │
│ │ scripts executed with │
│ │ Dagster's │
│ │ PipesSubprocessClient. │
└────────────────────────────────────────────────────────┴───────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Component Type ┃ Summary ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ dagster_components.lib.DefinitionsComponent │ Wraps an arbitrary │
│ │ set of Dagster │
│ │ definitions. │
│ dagster_components.lib.PipesSubprocessScriptCollectionComponent │ Assets that wrap │
│ │ Python scripts │
│ │ executed with │
│ │ Dagster's │
│ │ PipesSubprocessClie… │
└─────────────────────────────────────────────────────────────────┴──────────────────────┘
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
dg list component-type

Using /.../jaffle-platform/.venv/bin/dagster-components
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Component Type ┃ Summary ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ dagster_components.lib.DefinitionsComponent │ Wraps an arbitrary set of │
│ │ Dagster definitions. │
│ dagster_components.lib.PipesSubprocessScriptCollection │ Assets that wrap Python │
│ │ scripts executed with │
│ │ Dagster's │
│ │ PipesSubprocessClient. │
│ dagster_components.lib.SlingReplicationCollection │ Expose one or more Sling │
│ │ replications to Dagster as │
│ │ assets. │
└────────────────────────────────────────────────────────┴───────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Component Type ┃ Summary ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ dagster_components.lib.DefinitionsComponent │ Wraps an arbitrary │
│ │ set of Dagster │
│ │ definitions. │
│ dagster_components.lib.PipesSubprocessScriptCollectionComponent │ Assets that wrap │
│ │ Python scripts │
│ │ executed with │
│ │ Dagster's │
│ │ PipesSubprocessClie… │
│ dagster_components.lib.SlingReplicationCollectionComponent │ Expose one or more │
│ │ Sling replications │
│ │ to Dagster as │
│ │ assets. │
└─────────────────────────────────────────────────────────────────┴──────────────────────┘
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dg scaffold component 'dagster_components.lib.SlingReplicationCollection' ingest_files
dg scaffold component 'dagster_components.lib.SlingReplicationCollectionComponent' ingest_files

Creating a Dagster component instance folder at /.../jaffle-platform/jaffle_platform/components/ingest_files.
Using /.../jaffle-platform/.venv/bin/dagster-components
Loading