ruanwenjun commented on a change in pull request #6082:
URL: https://github.com/apache/dolphinscheduler/pull/6082#discussion_r702800168



##########
File path: 
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutor.java
##########
@@ -185,4 +190,34 @@ public static String getPythonHome(String envPath) {
         return null;
     }
 
+    /**
+     * get python home from the environment config
+     *
+     * @param environmentConfig env config
+     * @return python home
+     */
+    public static String getPythonHomeFromEnvironmentConfig(String 
environmentConfig) {
+        BufferedReader br = null;
+        StringBuilder sb = new StringBuilder();
+
+        String[] lines = environmentConfig.split("\n");
+
+        for (String line : lines) {
+            if (StringUtils.isNotEmpty(StringUtils.trim(line))) {
+                if (line.contains(Constants.PYTHON_HOME)) {
+                    sb.append(line);

Review comment:
       It's better to use string here.
   Or you can just use stream.filter() to find the first one.

##########
File path: 
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutor.java
##########
@@ -185,4 +190,34 @@ public static String getPythonHome(String envPath) {
         return null;
     }
 
+    /**
+     * get python home from the environment config
+     *
+     * @param environmentConfig env config
+     * @return python home
+     */
+    public static String getPythonHomeFromEnvironmentConfig(String 
environmentConfig) {
+        BufferedReader br = null;

Review comment:
       ```suggestion
   ```
   Remove the unused code.

##########
File path: sql/upgrade/1.4.0_schema/postgresql/dolphinscheduler_ddl.sql
##########
@@ -658,6 +658,64 @@ d//
 delimiter ;
 SELECT uc_dolphin_T_t_ds_schedules_A_add_timezone();
 DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_schedules_A_add_timezone();
+
+--
+-- Table structure for table t_ds_environment
+--
+DROP TABLE IF EXISTS t_ds_environment;
+CREATE TABLE t_ds_environment (
+    id serial NOT NULL  ,
+    code bigint NOT NULL,
+    name varchar(100) DEFAULT NULL ,
+    config text DEFAULT NULL ,
+    description text ,
+    operator int DEFAULT NULL ,
+    create_time timestamp DEFAULT NULL ,
+    update_time timestamp DEFAULT NULL ,
+    PRIMARY KEY (id) ,
+    CONSTRAINT environment_name_unique UNIQUE (name),
+    CONSTRAINT environment_code_unique UNIQUE (code)
+);
+
+ALTER TABLE t_ds_task_definition ADD COLUMN environment_code bigint DEFAULT 
NULL;
+comment on column t_ds_task_definition.environment_code is 'environment code';
+
+ALTER TABLE t_ds_task_definition_log ADD COLUMN environment_code bigint 
DEFAULT NULL;
+comment on column t_ds_task_definition_log.environment_code is 'environment 
code';
+
+ALTER TABLE t_ds_command ADD COLUMN environment_code bigint DEFAULT NULL;
+comment on column t_ds_command.environment_code is 'environment code';
+
+ALTER TABLE t_ds_error_command ADD COLUMN environment_code bigint DEFAULT NULL;
+comment on column t_ds_error_command.environment_code is 'environment code';
+
+ALTER TABLE t_ds_schedules ADD COLUMN environment_code bigint DEFAULT NULL;
+comment on column t_ds_schedules.environment_code is 'environment code';
+
+ALTER TABLE t_ds_process_instance ADD COLUMN environment_code bigint DEFAULT 
NULL;
+comment on column t_ds_process_instance.environment_code is 'environment code';
+
+ALTER TABLE t_ds_task_instance ADD COLUMN environment_code bigint DEFAULT NULL;
+comment on column t_ds_task_instance.environment_code is 'environment code';
+
+ALTER TABLE t_ds_task_instance ADD COLUMN environment_config text DEFAULT '';
+comment on column t_ds_task_instance.environment_config is 'environment 
config';
+
+--
+-- Table structure for table t_ds_environment_worker_group_relation
+--
+DROP TABLE IF EXISTS t_ds_environment_worker_group_relation;
+CREATE TABLE t_ds_environment_worker_group_relation (
+    id serial NOT NULL,
+    environment_code bigint NOT NULL,

Review comment:
       It seems this field is int in mysql.

##########
File path: sql/upgrade/1.4.0_schema/postgresql/dolphinscheduler_ddl.sql
##########
@@ -658,6 +658,64 @@ d//
 delimiter ;
 SELECT uc_dolphin_T_t_ds_schedules_A_add_timezone();
 DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_schedules_A_add_timezone();
+
+--
+-- Table structure for table t_ds_environment
+--
+DROP TABLE IF EXISTS t_ds_environment;
+CREATE TABLE t_ds_environment (
+    id serial NOT NULL  ,
+    code bigint NOT NULL,

Review comment:
       It seems this field is int in mysql.




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