dagster-io / dagster

An orchestration platform for the development, production, and observation of data assets.
https://dagster.io
Apache License 2.0
11.2k stars 1.41k forks source link

Jobs executed using `execute_in_process` can't be reexecuted in the UI #19458

Open georgesalvino1 opened 7 months ago

georgesalvino1 commented 7 months ago

Dagster version

1.6.1

What's the issue?

When triggering jobs through a Python script, calling it by using the execute_in_process method, the UI displays the following message when trying to re-execute the run:

dagster._check.CheckError: Expected non-None value: None
  File "/Users/george.salvino/miniforge3/envs/bert3.9/lib/python3.9/site-packages/dagster_graphql/implementation/utils.py", line 125, in _fn
    return fn(*args, **kwargs)
  File "/Users/george.salvino/miniforge3/envs/bert3.9/lib/python3.9/site-packages/dagster_graphql/implementation/utils.py", line 56, in _fn
    result = fn(self, graphene_info, *args, **kwargs)
  File "/Users/george.salvino/miniforge3/envs/bert3.9/lib/python3.9/site-packages/dagster_graphql/schema/roots/mutation.py", line 423, in mutate
    return launch_reexecution_from_parent_run(
  File "/Users/george.salvino/miniforge3/envs/bert3.9/lib/python3.9/site-packages/dagster_graphql/implementation/execution/launch_execution.py", line 89, in launch_reexecution_from_parent_run
    origin = check.not_none(parent_run.external_job_origin)
  File "/Users/george.salvino/miniforge3/envs/bert3.9/lib/python3.9/site-packages/dagster/_check/__init__.py", line 1009, in not_none
    raise CheckError(f"Expected non-None value: {additional_message}")

I was able to re-execute a run created through the CLI, but when that same job run is created through the script using execute_in_process, re-execution doesn't work.

It looks like for some reason, it's being unable to create that external_job_origin object when fetching info from that job.

What did you expect to happen?

Expected the run to be re-executed

How to reproduce?

Deployment type

Local

Deployment details

No response

Additional information

No response

Message from the maintainers

Impacted by this issue? Give it a đź‘Ť! We factor engagement into prioritization.

aniltolwani commented 6 months ago

Confirming I am also facing this issue!

OwenKephart commented 6 months ago

Hi @georgesalvino1 and @aniltolwani -- unfortunately this is somewhat expected behavior (although the error message is not particularly helpful). When you execute a job from a script like that, there is no way for dagster to access that same execution context when re-executing from the UI (as that script context is necessarily ephmeral). So "re-executing" that job is to some extent not possible -- you'd just be creating a new run of the same job (which would have a different executor and everything).