You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/09/25 10:38:49 UTC

[GitHub] [dolphinscheduler] zhongjiajie commented on a diff in pull request #12135: [DSIP-13][python]Sub problem: Add resource plugin support to task python, dataX, CustomDataX and Sql

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


##########
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/python.py:
##########
@@ -59,44 +59,46 @@ def foo():
         "raw_script",
     }
 
+    ext: set = {".py"}
+    ext_attr: str = "_raw_script"
+
     def __init__(
         self, name: str, definition: Union[str, types.FunctionType], *args, **kwargs
     ):
+        self._raw_script = self.raw_script(definition)
         super().__init__(name, TaskType.PYTHON, *args, **kwargs)
-        self.definition = definition

Review Comment:
   And keep  other setting in the old style



##########
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/python.py:
##########
@@ -59,44 +59,46 @@ def foo():
         "raw_script",
     }
 
+    ext: set = {".py"}
+    ext_attr: str = "_raw_script"
+
     def __init__(
         self, name: str, definition: Union[str, types.FunctionType], *args, **kwargs
     ):
+        self._raw_script = self.raw_script(definition)
         super().__init__(name, TaskType.PYTHON, *args, **kwargs)
-        self.definition = definition

Review Comment:
   we should not remove the statement `self.definition = definition`, I think we should better use 
   
   ```python
       # For extension record
       ext: set = {".py"}
       ext_attr: str = "_definition"
   
       def __init__(
            self, name: str, definition: Union[str, types.FunctionType], *args, **kwargs
        ):
            self._raw_script = self.raw_script(definition)
            super().__init__(name, TaskType.PYTHON, *args, **kwargs)
            self._definition = definition
   ```



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org