kaxil commented on code in PR #72696:
URL: https://github.com/apache/airflow/pull/72696#discussion_r3963869681


##########
providers/teradata/src/airflow/providers/teradata/triggers/teradata_compute_cluster.py:
##########
@@ -69,70 +68,32 @@ def serialize(self) -> tuple[str, dict[str, Any]]:
 
     async def run(self) -> AsyncIterator[TriggerEvent]:
         """Wait for Compute Cluster operation to complete."""
+        if self.operation_type in (Constants.CC_SUSPEND_OPR, 
Constants.CC_CREATE_SUSPEND_OPR):

Review Comment:
   Now that unrecognised values are rejected, the class docstring is the only 
place a user can look up which ones are accepted, and it is wrong twice over: 
it names the parameter `opr_type` (it is `operation_type`) and lists only 
SUSPEND/RESUME, while CREATE and CREATE_SUSPEND are accepted here too. Worth 
fixing in the same PR.
   
   Non-blocking.



##########
providers/teradata/src/airflow/providers/teradata/triggers/teradata_compute_cluster.py:
##########
@@ -69,70 +68,32 @@ def serialize(self) -> tuple[str, dict[str, Any]]:
 
     async def run(self) -> AsyncIterator[TriggerEvent]:
         """Wait for Compute Cluster operation to complete."""
+        if self.operation_type in (Constants.CC_SUSPEND_OPR, 
Constants.CC_CREATE_SUSPEND_OPR):
+            expected_status = Constants.CC_SUSPEND_DB_STATUS
+        elif self.operation_type in (Constants.CC_RESUME_OPR, 
Constants.CC_CREATE_OPR):
+            expected_status = Constants.CC_RESUME_DB_STATUS
+        else:
+            yield TriggerEvent({"status": "error", "message": "Invalid 
operation"})

Review Comment:
   This branch was unreachable before, so "Invalid operation" is effectively a 
new user-facing message, and it does not say which value got rejected. The 
operator turns it straight into `AirflowException(event["message"])`, so that 
bare string is all the task log gets. Could it include `self.operation_type`?
   
   Non-blocking.



-- 
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]

Reply via email to