ashb commented on code in PR #68106:
URL: https://github.com/apache/airflow/pull/68106#discussion_r3397057548
##########
airflow-core/src/airflow/dag_processing/processor.py:
##########
@@ -624,75 +605,11 @@ def _create_log_forwarder(
)
def _handle_request(self, msg: ToManager, log: FilteringBoundLogger,
req_id: int) -> None:
- from airflow.sdk.api.datamodels._generated import (
- ConnectionResponse,
- VariableResponse,
- )
-
- resp: BaseModel | None = None
- dump_opts: dict[str, bool] = {}
if isinstance(msg, DagFileParsingResult):
self.parsing_result = msg
- elif isinstance(msg, GetConnection):
- conn = self.client.connections.get(msg.conn_id)
- if isinstance(conn, ConnectionResponse):
- if conn.password:
- mask_secret(conn.password)
- if conn.extra:
- mask_secret(conn.extra)
- conn_result = ConnectionResult.from_conn_response(conn)
- resp = conn_result
- dump_opts = {"exclude_unset": True, "by_alias": True}
- else:
- resp = conn
- elif isinstance(msg, GetVariable):
- var = self.client.variables.get(msg.key)
- if isinstance(var, VariableResponse):
- if var.value:
- mask_secret(var.value, var.key)
- var_result = VariableResult.from_variable_response(var)
- resp = var_result
- dump_opts = {"exclude_unset": True}
- else:
- resp = var
- elif isinstance(msg, GetVariableKeys):
- resp, dump_opts = handle_get_variable_keys(self.client, msg)
- elif isinstance(msg, PutVariable):
- resp, dump_opts = handle_put_variable(self.client, msg)
- elif isinstance(msg, DeleteVariable):
- resp, dump_opts = handle_delete_variable(self.client, msg)
- elif isinstance(msg, GetPreviousDagRun):
- resp, dump_opts = handle_get_previous_dag_run(self.client, msg)
- elif isinstance(msg, GetPrevSuccessfulDagRun):
- resp, dump_opts = handle_get_prev_successful_dag_run(self.client,
self.id)
- elif isinstance(msg, GetXCom):
- resp, dump_opts = handle_get_xcom(self.client, msg)
- elif isinstance(msg, GetXComCount):
- resp, dump_opts = handle_get_xcom_count(self.client, msg)
- elif isinstance(msg, GetXComSequenceItem):
- resp, dump_opts = handle_get_xcom_sequence_item(self.client, msg)
- elif isinstance(msg, GetXComSequenceSlice):
- resp, dump_opts = handle_get_xcom_sequence_slice(self.client, msg)
- elif isinstance(msg, MaskSecret):
- handle_mask_secret(msg)
- elif isinstance(msg, GetTICount):
- resp, dump_opts = handle_get_ti_count(self.client, msg)
- elif isinstance(msg, GetTaskStates):
- resp, dump_opts = handle_get_task_states(self.client, msg)
- elif isinstance(msg, GetPreviousTI):
- resp, dump_opts = handle_get_previous_ti(self.client, msg)
- else:
- log.error("Unhandled request", msg=msg)
- self.send_msg(
- None,
- request_id=req_id,
- error=ErrorResponse(
- detail={"status_code": 400, "message": "Unhandled
request"},
- ),
- )
+ self.send_msg(None, request_id=req_id, error=None)
return
-
- self.send_msg(resp, request_id=req_id, error=None, **dump_opts)
+ super()._handle_request(msg, log, req_id)
Review Comment:
The list of messages to handle in the DagProcessor was a _deliberate_ choice
-- not every message that a task can send and runtime makes sense in a dag
parsing context, and some are actively harmful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]