common.configuration.specs.pluggable_run_context
SupportsRunContext Objects
class SupportsRunContext(Protocol)
Describes where dlt
looks for settings, pipeline working folder. Implementations must be picklable.
__init__
def __init__(run_dir: Optional[str], *args: Any, **kwargs: Any)
An explicit run_dir, if None, run_dir should be auto-detected by particular implementation
name
@property
def name() -> str
Name of the run context. Entities like sources and destinations added to registries when this context
is active, will be scoped to it. Typically corresponds to Python package name ie. dlt
.
global_dir
@property
def global_dir() -> str
Directory in which global settings are stored ie ~/.dlt/
run_dir
@property
def run_dir() -> str
Defines the current working directory, defaults to cwd()
local_dir
@property
def local_dir() -> str
Defines data dir where local relative dirs and files are created, defaults to run_dir
settings_dir
@property
def settings_dir() -> str
Defines where the current settings (secrets and configs) are located
data_dir
@property
def data_dir() -> str
Defines where the pipelines working folders are stored.
module
@property
def module() -> Optional[ModuleType]
if run_dir is a top level importable python module, returns it, otherwise return None
runtime_kwargs
@property
def runtime_kwargs() -> Dict[str, Any]
Additional kwargs used to initialize this instance of run context, used for reloading
initial_providers
def initial_providers() -> List[ConfigProvider]
Returns initial providers for this context
get_data_entity
def get_data_entity(entity: str) -> str
Gets path in data_dir where entity
(ie. pipelines
, repos
) are stored
get_run_entity
def get_run_entity(entity: str) -> str
Gets path in run_dir where entity
(ie. sources
, destinations
etc.) are stored
get_setting
def get_setting(setting_path: str) -> str
Gets path in settings_dir where setting (ie. secrets.toml
) are stored
unplug
def unplug() -> None
Called when context removed from container
plug
def plug() -> None
Called when context is added to container
PluggableRunContext Objects
class PluggableRunContext(ContainerInjectableContext)
Injectable run context taken via plugin
reload
def reload(run_dir_or_context: Optional[Union[str, SupportsRunContext]] = None,
runtime_kwargs: Dict[str, Any] = None) -> None
Reloads the context, using existing settings if not overwritten with method args
push_context
def push_context() -> str
Pushes current context on stack and returns assert cookie
pop_context
def pop_context(cookie: str) -> None
Pops context from stack and re-initializes it if in container
drop_context
def drop_context(cookie: str) -> None
Pops context form stack but leaves new context for good