common.runtime.run_context
RunContext Objects
class RunContext(SupportsRunContext)
A default run context used by dlt
run_dir
@property
def run_dir() -> str
The default run dir is the current working directory but may be overridden by DLT_PROJECT_DIR env variable.
settings_dir
@property
def settings_dir() -> str
Returns a path to dlt settings directory. If not overridden it resides in current working directory
The name of the setting folder is '.dlt'. The path is current working directory '.' but may be overridden by DLT_PROJECT_DIR env variable.
data_dir
@property
def data_dir() -> str
Gets default directory where pipelines' data (working directories) will be stored
- if DLT_DATA_DIR is set in env then it is used
- in user home directory: ~/.dlt/
- if current user is root: in /var/dlt/
- if current user does not have a home directory: in /tmp/dlt/
get_run_entity
def get_run_entity(entity: str) -> str
Default run context assumes that entities are defined in root dir
plug_run_context
@plugins.hookspec(firstresult=True)
def plug_run_context(
run_dir: Optional[str],
runtime_kwargs: Optional[Dict[str, Any]]) -> SupportsRunContext
Spec for plugin hook that returns current run context.
Arguments:
run_dir
str - An initial run directory of the contextruntime_kwargs
- Any additional arguments passed to the context via PluggableRunContext.reload
Returns:
SupportsRunContext
- A run context implementing SupportsRunContext protocol
current
def current() -> SupportsRunContext
Returns currently active run context