Skip to content

Commit

Permalink
feat: anchor run context to data package dir
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed Nov 17, 2024
1 parent 05e6bd9 commit c7866b3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cdf/core/extract_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,19 @@ def _inject_provider(self):
from dlt.common.configuration.container import Container
from dlt.common.configuration.providers import CustomLoaderDocProvider
from dlt.common.configuration.specs import PluggableRunContext
from dlt.common.runtime.run_context import RunContext

with Container().injectable_context(PluggableRunContext()) as dlt_context:
with Container().injectable_context(
PluggableRunContext(RunContext(run_dir=self.package_path))
) as dlt_context:
provider_name = f"cdf.{self.package_path.name}.configuration"
if provider_name not in dlt_context.providers:
logger.debug("Injecting CDF configuration provider: %s", provider_name)
dlt_context.providers.add_provider(
CustomLoaderDocProvider(provider_name, lambda: self.config)
)
yield
logger.debug("Restoring DLT context")


class SlingPipelineProtocol(t.Protocol):
Expand Down

0 comments on commit c7866b3

Please sign in to comment.