Skip to content

Logs disappearing for deferred CloudRunExecuteJobOperator while state is deferred #58676

@MarcusCramer91

Description

@MarcusCramer91

Apache Airflow version

Other Airflow 2/3 version (please specify below)

If "Other Airflow 2/3 version" selected, which one?

3.1.1

What happened?

I am using a custom class that extends CloudRunExecuteJobOperator and overrides the pre_execute and execute functions. Among other things, these functions produce logs.

When running the DAG with that class and deferrable=True those logs briefly appear in the UI. Then they disappear, only to re-appear when the status is no longer deferred.

Sounds similar to this one #28647, but that issue is pretty old...

What you think should happen instead?

I should be seeing all logs all the time, regardless of the tasks status.

Since I am pretty sure this is related to deferred maybe there is also another proper way to see the logs, or a workaround for this?

How to reproduce

Use this in a DAG:

class CustomCloudRunJobOperator(CloudRunExecuteJobOperator):
    def pre_execute(self, context: Context) -> None:
        self.log.info("Some log here")
        super().pre_execute(context)

Operating System

Debian GNU/Linux 12 (bookworm)

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions