ephraimbuddy commented on code in PR #28397:
URL: https://github.com/apache/airflow/pull/28397#discussion_r1050771058


##########
airflow/models/dag.py:
##########
@@ -2586,14 +2586,23 @@ def create_dagrun(
             else:
                 data_interval = 
self.infer_automated_data_interval(logical_date)
 
+        if run_type is not None and not isinstance(run_type, DagRunType):
+            raise ValueError(f"`run_type` should be a DagRunType, not 
{type(run_type)}")
+
         if run_id:  # Infer run_type from run_id if needed.
             if not isinstance(run_id, str):
                 raise ValueError(f"`run_id` should be a str, not 
{type(run_id)}")
-            if not run_type:
-                run_type = DagRunType.from_run_id(run_id)
+            inferred_run_type = DagRunType.from_run_id(run_id)
+            if run_type is None:
+                # No explicit type given, use the inferred type.
+                run_type = inferred_run_type
+            elif run_type == DagRunType.MANUAL and inferred_run_type != 
DagRunType.MANUAL:

Review Comment:
   ```suggestion
               elif run_type != inferred_run_type:
   ```
   Should we do it this way?



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