"""Collection of Dagster resources for PUDL."""fromdagsterimportConfigurableResource,Field,resourcefrompudl.settingsimportDatasetsSettings,FercToSqliteSettings,create_dagster_configfrompudl.workspace.datastoreimportDatastorefrompudl.workspace.setupimportPudlPaths
[docs]classRuntimeSettings(ConfigurableResource):"""Encodes runtime settings for the ferc_to_sqlite graphs."""
[docs]defdataset_settings(init_context)->DatasetsSettings:"""Dagster resource for parameterizing PUDL ETL assets. This resource allows us to specify the years we want to process for each datasource in the Dagit UI. """returnDatasetsSettings(**init_context.resource_config)
[docs]defferc_to_sqlite_settings(init_context)->FercToSqliteSettings:"""Dagster resource for parameterizing the ``ferc_to_sqlite`` graph. This resource allows us to specify the years we want to process for each datasource in the Dagit UI. """returnFercToSqliteSettings(**init_context.resource_config)
@resource(config_schema={"gcs_cache_path":Field(str,description="Load datastore resources from Google Cloud Storage.",default_value="",),"use_local_cache":Field(bool,description="If enabled, the local file cache for datastore will be used.",default_value=True,),},)
[docs]defdatastore(init_context)->Datastore:"""Dagster resource to interact with Zenodo archives."""ds_kwargs={}ds_kwargs["gcs_cache_path"]=init_context.resource_config["gcs_cache_path"]ifinit_context.resource_config["use_local_cache"]:# TODO(rousik): we could also just use PudlPaths().input_dir here, because# it should be initialized to the right values.ds_kwargs["local_cache_path"]=PudlPaths().input_dirreturnDatastore(**ds_kwargs)