pierrejeambrun commented on code in PR #47360:
URL: https://github.com/apache/airflow/pull/47360#discussion_r1981032829


##########
task_sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -769,10 +766,12 @@ def partial_subset(
         memo = {id(self.task_dict): None, id(self.task_group): None}
         dag = copy.deepcopy(self, memo)  # type: ignore
 
-        if isinstance(task_ids_or_regex, (str, Pattern)):
-            matched_tasks = [t for t in self.tasks if 
re2.findall(task_ids_or_regex, t.task_id)]
+        if isinstance(task_ids, str):
+            matched_tasks = [t for t in self.tasks if str(task_ids) in 
t.task_id]

Review Comment:
   `task_ids` is already a str in this code path.
   
   ```suggestion
               matched_tasks = [t for t in self.tasks if task_ids in t.task_id]
   ```



##########
task_sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -769,10 +766,12 @@ def partial_subset(
         memo = {id(self.task_dict): None, id(self.task_group): None}
         dag = copy.deepcopy(self, memo)  # type: ignore
 
-        if isinstance(task_ids_or_regex, (str, Pattern)):
-            matched_tasks = [t for t in self.tasks if 
re2.findall(task_ids_or_regex, t.task_id)]
+        if isinstance(task_ids, str):
+            matched_tasks = [t for t in self.tasks if str(task_ids) in 
t.task_id]
         else:
-            matched_tasks = [t for t in self.tasks if t.task_id in 
task_ids_or_regex]
+            matched_tasks = [
+                t for t in self.tasks if any(task_id for task_id in task_ids 
if str(task_id) in t.task_id)
+            ]

Review Comment:
   What was there before seemed easier to understand to me, and was working for 
`Iterable[str]`.



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