Skip to content

Generalize on_kill() for SQLExecuteQueryOperator #27314

Description

@eladkal

Body

The operator doesn't have on_kill method and we try to find a way to make a generalized one.
Referencing TrinoOperator:

def on_kill(self) -> None:
if self._hook is not None and isinstance(self._hook, TrinoHook):
query_id = "'" + self._hook.query_id + "'"
try:
self.log.info("Stopping query run with queryId - %s", self._hook.query_id)
self._hook.run(
sql=f"CALL system.runtime.kill_query(query_id => {query_id},message => 'Job "
f"killed by "
f"user');",
handler=list,
)
except TrinoQueryError as e:
self.log.info(str(e))
self.log.info("Trino query (%s) terminated", query_id)

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions