Exemplo n.º 1
0
def initialize_step_context(scratch_dir, instance):
    pipeline_run = PipelineRun(
        pipeline_name="foo_pipeline",
        run_id=str(uuid.uuid4()),
        run_config=make_run_config(scratch_dir, "external"),
        mode="external",
    )

    plan = create_execution_plan(reconstructable(define_basic_pipeline),
                                 pipeline_run.run_config,
                                 mode="external")

    initialization_manager = PipelineExecutionContextManager(
        plan,
        pipeline_run.run_config,
        pipeline_run,
        instance,
    )
    for _ in initialization_manager.prepare_context():
        pass
    pipeline_context = initialization_manager.get_context()

    step_context = pipeline_context.for_step(
        plan.get_step_by_key("return_two"))
    return step_context
Exemplo n.º 2
0
def initialize_step_context(scratch_dir):
    pipeline_run = PipelineRun(
        pipeline_name='foo_pipeline',
        run_id=str(uuid.uuid4()),
        run_config=make_run_config(scratch_dir, 'external'),
        mode='external',
    )

    plan = create_execution_plan(reconstructable(define_basic_pipeline),
                                 pipeline_run.run_config,
                                 mode='external')

    initialization_manager = PipelineExecutionContextManager(
        plan,
        pipeline_run.run_config,
        pipeline_run,
        DagsterInstance.ephemeral(),
    )
    for _ in initialization_manager.prepare_context():
        pass
    pipeline_context = initialization_manager.get_context()

    active_execution = plan.start(retries=Retries(RetryMode.DISABLED))
    step = active_execution.get_next_step()
    step_context = pipeline_context.for_step(step)
    return step_context