Skip to content

Commit

Permalink
[components] Add *Component suffix to all component classes
Browse files Browse the repository at this point in the history
[INTERNAL_BRANCH=sean/components/add-component-suffix]
  • Loading branch information
smackesey committed Feb 27, 2025
1 parent fec9ec0 commit 980534c
Show file tree
Hide file tree
Showing 38 changed files with 258 additions and 218 deletions.
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

0 comments on commit 980534c

Please sign in to comment.