Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace external_trigger check with DagRunType #45932

Open
kaxil opened this issue Jan 22, 2025 · 2 comments · May be fixed by #45961
Open

Replace external_trigger check with DagRunType #45932

kaxil opened this issue Jan 22, 2025 · 2 comments · May be fixed by #45961
Assignees
Milestone

Comments

@kaxil
Copy link
Member

kaxil commented Jan 22, 2025

Now that we have explicit Dag Run types, we should not need DagRun.external_trigger too.

Example, the following code can be changed

def choose_branch(self, context: Context) -> str | Iterable[str]:
# If the DAG Run is externally triggered, then return without
# skipping downstream tasks
dag_run: DagRun = context["dag_run"] # type: ignore[assignment]
if dag_run.external_trigger:
self.log.info("Externally triggered DAG_Run: allowing execution to proceed.")
return list(context["task"].get_direct_relative_ids(upstream=False))

to

    def choose_branch(self, context: Context) -> str | Iterable[str]:
        # If the DAG Run is manually triggered, then return without
        # skipping downstream tasks
        dag_run: DagRun = context["dag_run"]  # type: ignore[assignment]
        if dag_run.run_type == DagRunType.MANUAL:
            self.log.info("Externally triggered DAG_Run: allowing execution to proceed.")
            return list(context["task"].get_direct_relative_ids(upstream=False))

We should replace all usages of DagRun.external_trigger and remove it from DB too.

@jason810496
Copy link
Contributor

Hi @kaxil, I can work on this issue, could you assign to me ? Thanks !

@kaxil
Copy link
Member Author

kaxil commented Jan 22, 2025

Awesome, assigned it to you

@jason810496 jason810496 linked a pull request Jan 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants