Eduardo Muñoz
04/19/2023, 10:21 AMlocal_file_manager
, which basically returns an instance of LocalFileManager
How could I merge the usage of ConfigurableResource
and LocalFileManager
?
I've tried:
from typing import Any
from dagster import ConfigurableResource
from dagster._core.storage.file_manager import (
LocalFileManager as DagsterLocalFileManager,
)
class LocalFileManager(ConfigurableResource, DagsterLocalFileManager):
base_dir: str
def __init__(self, **data: Any):
ConfigurableResource.__init__(self, **data)
DagsterLocalFileManager.__init__(self, self.base_dir)
But I get the following error:
TypeError: "LocalFileManager" is immutable and does not support item assignment
Tim Castillo
04/19/2023, 7:30 PMowen
04/19/2023, 10:26 PMConfigurableResourceFactory
instead of a ConfigurableResource
. The ConfigurableResource
class is used when you're defining your own resource from scratch (so you can combine the configuration and the implementation) but when you want to use the config system to configure a pre-defined class, then you'll want the factory. That would look like
class LocalFileManagerResource(ConfiugrableResourceFactory[LocalFileManager]):
base_dir: str
def create_resource(self, _init_context) -> LocalFileManager:
return LocalFileManager(self.base_dir)
Eduardo Muñoz
04/20/2023, 6:31 AMConfigurableResourceFactory
exported from?Chaitya
04/26/2023, 1:21 AMfrom dagster._config.pythonic_config import ConfigurableResourceFactory
Eduardo Muñoz
05/04/2023, 12:58 PM