zhongjiajie commented on code in PR #10515:
URL: https://github.com/apache/dolphinscheduler/pull/10515#discussion_r903495127


##########
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/python.py:
##########
@@ -100,3 +108,21 @@ def raw_script(self) -> str:
             raise PyDSParamException(
                 "Parameter definition do not support % for now.", 
type(self.definition)
             )
+
+    @property
+    def resource_list(self) -> List:
+        """Get python task define attribute `resource_list`."""
+        if super().resource_list is not None and len(super().resource_list) > 
0:
+            for resource in super().resource_list:
+                if (
+                    resource.get("id") is None
+                    and resource.get("resourceName") is not None
+                ):
+                    if resource.get("resourceType") is not None:
+                        resource_type = resource.get("resourceType")
+                    else:
+                        resource_type = "FILE"
+                    resource["id"] = self.query_resource(
+                        resource_type, resource.get("resourceName")
+                    ).get("id")
+        return super().resource_list

Review Comment:
   And if we finish 
https://github.com/apache/dolphinscheduler/pull/10515#discussion_r903492117, 
user can not pass `[{"resourceName": "/abce/aa.py"}, {"resourceName": 
"/abce/bb.py"}]` to `resource_list` anymore, they can simply pass 
`["/abce/aa.py", ""/abce/bb.py""]` to it, and we will autofill the 
`resourceName` keyword adn return with `id`. WDTY?



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