-
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.
[structured config] Migrate resources from project-fully-featured to …
…struct config resources
- Loading branch information
Showing
9 changed files
with
113 additions
and
101 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
26 changes: 15 additions & 11 deletions
26
...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,19 @@ | ||
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 ResourceDependency, StructuredConfigIOManagerBase | ||
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): | ||
""" | ||
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}, | ||
class CommonBucketS3PickleIOManager(StructuredConfigIOManagerBase): | ||
s3_bucket: ResourceDependency[str] | ||
s3: ResourceDependency[Any] | ||
|
||
def create_io_manager_to_pass_to_user_code(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
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.