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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to