-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[structured config] Migrate resources from project-fully-featured to …
…struct config resources (#11785) ## Summary Migrates the experimental copy of `project-fully-featured` to use struct config resources instead of traditional function-based resources. ## Test Plan Existing unit tests.
- Loading branch information
Showing
13 changed files
with
144 additions
and
125 deletions.
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
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
24 changes: 16 additions & 8 deletions
24
...urces/project_fully_featured_v2_resources/resources/common_bucket_s3_pickle_io_manager.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,15 +1,23 @@ | ||
from dagster import build_init_resource_context, io_manager | ||
from typing import Any | ||
|
||
from dagster import build_init_resource_context | ||
from dagster._config.structured_config import ConfigurableIOManagerInjector, ResourceDependency | ||
from dagster._core.storage.io_manager import IOManager | ||
from dagster_aws.s3 import s3_pickle_io_manager | ||
|
||
|
||
@io_manager(required_resource_keys={"s3_bucket", "s3"}) | ||
def common_bucket_s3_pickle_io_manager(init_context): | ||
class CommonBucketS3PickleIOManager(ConfigurableIOManagerInjector): | ||
""" | ||
A version of the s3_pickle_io_manager that gets its bucket from another resource. | ||
""" | ||
return s3_pickle_io_manager( | ||
build_init_resource_context( | ||
config={"s3_bucket": init_context.resources.s3_bucket}, | ||
resources={"s3": init_context.resources.s3}, | ||
|
||
s3_bucket: str | ||
s3: ResourceDependency[Any] | ||
|
||
def create_io_manager_to_inject(self, context) -> IOManager: | ||
return s3_pickle_io_manager( | ||
build_init_resource_context( | ||
config={"s3_bucket": self.s3_bucket}, | ||
resources={"s3": self.s3}, | ||
) | ||
) | ||
) |
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
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
Oops, something went wrong.