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/05 14:17:48 UTC

[GitHub] [dolphinscheduler] zhongjiajie commented on a diff in pull request #11763: [Feature][python] Add parameter environment to task

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


##########
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/task.py:
##########
@@ -145,6 +147,8 @@ def __init__(
         # move attribute code and version after _process_definition and process_definition declare
         self.code, self.version = self.gen_code_and_version()
         # Add task to process definition, maybe we could put into property process_definition latter
+        self.environment_code = self.get_env_code(environment_name)

Review Comment:
   can we change this line to `self.environment_name = environment_name` and also change function `get_env_code` to 
   
   ```py
       @property
       def environment_code(self, env_name: str) -> str:
            """Convert environment name to code."""
            if env_name is None:
                return None
            return JavaGate().query_environment_info(env_name)
   ```
   
   We should keep init function as simple as possible, complex init function will take more time in class initialize and make more risk on it



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