amoghrajesh commented on code in PR #53514:
URL: https://github.com/apache/airflow/pull/53514#discussion_r2238555444
##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -427,6 +445,22 @@ def _handle_request(self, msg: ToTriggerSupervisor, log:
FilteringBoundLogger, r
dump_opts = {"exclude_unset": True}
else:
resp = var
+ elif isinstance(msg, PutVariable):
+ var = self.client.variables.set(msg.key, msg.value,
msg.description)
+ if isinstance(var, VariableResponse):
+ var_result = VariableResult.from_variable_response(var)
+ resp = var_result
+ dump_opts = {"exclude_unset": True}
+ else:
+ resp = var
Review Comment:
Same here.
##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -427,6 +445,22 @@ def _handle_request(self, msg: ToTriggerSupervisor, log:
FilteringBoundLogger, r
dump_opts = {"exclude_unset": True}
else:
resp = var
+ elif isinstance(msg, PutVariable):
+ var = self.client.variables.set(msg.key, msg.value,
msg.description)
+ if isinstance(var, VariableResponse):
+ var_result = VariableResult.from_variable_response(var)
+ resp = var_result
+ dump_opts = {"exclude_unset": True}
+ else:
+ resp = var
+ elif isinstance(msg, DeleteXCom):
+ xcom = self.client.xcoms.delete(msg.dag_id, msg.run_id,
msg.task_id, msg.key, msg.map_index)
+ if isinstance(xcom, XComResponse):
+ xcom_result = XComResult.from_xcom_response(xcom)
+ resp = xcom_result
+ dump_opts = {"exclude_unset": True}
+ else:
+ resp = xcom
Review Comment:
Here as well
##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -435,6 +469,16 @@ def _handle_request(self, msg: ToTriggerSupervisor, log:
FilteringBoundLogger, r
dump_opts = {"exclude_unset": True}
else:
resp = xcom
+ elif isinstance(msg, SetXCom):
+ xcom = self.client.xcoms.set(
+ msg.dag_id, msg.run_id, msg.task_id, msg.key, msg.value,
msg.map_index, msg.mapped_length
+ )
+ if isinstance(xcom, XComResponse):
+ xcom_result = XComResult.from_xcom_response(xcom)
+ resp = xcom_result
+ dump_opts = {"exclude_unset": True}
+ else:
+ resp = xcom
Review Comment:
Here as well.
##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -419,6 +429,14 @@ def _handle_request(self, msg: ToTriggerSupervisor, log:
FilteringBoundLogger, r
dump_opts = {"exclude_unset": True, "by_alias": True}
else:
resp = conn
+ elif isinstance(msg, DeleteVariable):
+ var = self.client.variables.delete(msg.key)
+ if isinstance(var, VariableResponse):
+ var_result = VariableResult.from_variable_response(var)
+ resp = var_result
+ dump_opts = {"exclude_unset": True}
+ else:
+ resp = var
Review Comment:
This isn't correct. The `DeleteVariable` message type doesn't return a
`VariableResponse`, it should be `OKResponse`. Check
https://github.com/apache/airflow/blob/main/task-sdk/src/airflow/sdk/execution_time/supervisor.py#L1244-L1245
--
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]