status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
unknown | language
stringclasses 5
values | commit_datetime
unknown | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final int HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH = 10;
public static final int HEARTBEAT_WITH_WEIGHT_FOR_ZOOKEEPER_INFO_LENGTH = 11;
/**
* jar
*/
public static final String JAR = "jar";
/**
* hadoop
*/
public static final String HADOOP = "hadoop";
/**
* -D <property>=<value>
*/
public static final String D = "-D";
/**
* -D mapreduce.job.name=name
*/
public static final String MR_NAME = "mapreduce.job.name";
/**
* -D mapreduce.job.queuename=queuename
*/
public static final String MR_QUEUE = "mapreduce.job.queuename";
/**
* spark params constant
*/
public static final String MASTER = "--master";
public static final String DEPLOY_MODE = "--deploy-mode";
/**
* --class CLASS_NAME
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String MAIN_CLASS = "--class";
/**
* --driver-cores NUM
*/
public static final String DRIVER_CORES = "--driver-cores";
/**
* --driver-memory MEM
*/
public static final String DRIVER_MEMORY = "--driver-memory";
/**
* --num-executors NUM
*/
public static final String NUM_EXECUTORS = "--num-executors";
/**
* --executor-cores NUM
*/
public static final String EXECUTOR_CORES = "--executor-cores";
/**
* --executor-memory MEM
*/
public static final String EXECUTOR_MEMORY = "--executor-memory";
/**
* --name NAME
*/
public static final String SPARK_NAME = "--name";
/**
* --queue QUEUE
*/
public static final String SPARK_QUEUE = "--queue";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * exit code success
*/
public static final int EXIT_CODE_SUCCESS = 0;
/**
* exit code kill
*/
public static final int EXIT_CODE_KILL = 137;
/**
* exit code failure
*/
public static final int EXIT_CODE_FAILURE = -1;
/**
* date format of yyyyMMdd
*/
public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd";
/**
* date format of yyyyMMddHHmmss
*/
public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss";
/**
* system date(yyyyMMddHHmmss)
*/
public static final String PARAMETER_DATETIME = "system.datetime";
/**
* system date(yyyymmdd) today
*/
public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate";
/**
* system date(yyyymmdd) yesterday
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String PARAMETER_BUSINESS_DATE = "system.biz.date";
/**
* ACCEPTED
*/
public static final String ACCEPTED = "ACCEPTED";
/**
* SUCCEEDED
*/
public static final String SUCCEEDED = "SUCCEEDED";
/**
* NEW
*/
public static final String NEW = "NEW";
/**
* NEW_SAVING
*/
public static final String NEW_SAVING = "NEW_SAVING";
/**
* SUBMITTED
*/
public static final String SUBMITTED = "SUBMITTED";
/**
* FAILED
*/
public static final String FAILED = "FAILED";
/**
* KILLED
*/
public static final String KILLED = "KILLED";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * RUNNING
*/
public static final String RUNNING = "RUNNING";
/**
* underline "_"
*/
public static final String UNDERLINE = "_";
/**
* quartz job prifix
*/
public static final String QUARTZ_JOB_PRIFIX = "job";
/**
* quartz job group prifix
*/
public static final String QUARTZ_JOB_GROUP_PRIFIX = "jobgroup";
/**
* projectId
*/
public static final String PROJECT_ID = "projectId";
/**
* processId
*/
public static final String SCHEDULE_ID = "scheduleId";
/**
* schedule
*/
public static final String SCHEDULE = "schedule";
/**
* application regex
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String APPLICATION_REGEX = "application_\\d+_\\d+";
public static final String PID = OSUtils.isWindows() ? "handle" : "pid";
/**
* month_begin
*/
public static final String MONTH_BEGIN = "month_begin";
/**
* add_months
*/
public static final String ADD_MONTHS = "add_months";
/**
* month_end
*/
public static final String MONTH_END = "month_end";
/**
* week_begin
*/
public static final String WEEK_BEGIN = "week_begin";
/**
* week_end
*/
public static final String WEEK_END = "week_end";
/**
* timestamp
*/
public static final String TIMESTAMP = "timestamp";
public static final char SUBTRACT_CHAR = '-';
public static final char ADD_CHAR = '+';
public static final char MULTIPLY_CHAR = '*';
public static final char DIVISION_CHAR = '/'; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final char LEFT_BRACE_CHAR = '(';
public static final char RIGHT_BRACE_CHAR = ')';
public static final String ADD_STRING = "+";
public static final String MULTIPLY_STRING = "*";
public static final String DIVISION_STRING = "/";
public static final String LEFT_BRACE_STRING = "(";
public static final char P = 'P';
public static final char N = 'N';
public static final String SUBTRACT_STRING = "-";
public static final String GLOBAL_PARAMS = "globalParams";
public static final String LOCAL_PARAMS = "localParams";
public static final String LOCAL_PARAMS_LIST = "localParamsList";
public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId";
public static final String PROCESS_INSTANCE_STATE = "processInstanceState";
public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance";
public static final String TASK_TYPE = "taskType";
public static final String TASK_LIST = "taskList";
public static final String RWXR_XR_X = "rwxr-xr-x";
public static final String QUEUE = "queue";
public static final String QUEUE_NAME = "queueName";
public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0;
public static final int LOG_QUERY_LIMIT = 4096;
/**
* master/worker server use for zk
*/
public static final String MASTER_TYPE = "master";
public static final String WORKER_TYPE = "worker";
public static final String DELETE_ZK_OP = "delete";
public static final String ADD_ZK_OP = "add";
public static final String ALIAS = "alias"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String CONTENT = "content";
public static final String DEPENDENT_SPLIT = ":||";
public static final String DEPENDENT_ALL = "ALL";
/**
* preview schedule execute count
*/
public static final int PREVIEW_SCHEDULE_EXECUTE_COUNT = 5;
/**
* kerberos
*/
public static final String KERBEROS = "kerberos";
/**
* kerberos expire time
*/
public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time";
/**
* java.security.krb5.conf
*/
public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf";
/**
* java.security.krb5.conf.path
*/
public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path";
/**
* hadoop.security.authentication
*/
public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication";
/**
* hadoop.security.authentication
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state";
/**
* com.amazonaws.services.s3.enableV4
*/
public static final String AWS_S3_V4 = "com.amazonaws.services.s3.enableV4";
/**
* loginUserFromKeytab user
*/
public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username";
/**
* default worker group id
*/
public static final int DEFAULT_WORKER_ID = -1;
/**
* loginUserFromKeytab path
*/
public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path";
/**
* task log info format
*/
public static final String TASK_LOG_INFO_FORMAT = "TaskLogInfo-%s";
/**
* hive conf
*/
public static final String HIVE_CONF = "hiveconf:";
/**
* flink
*/
public static final String FLINK_YARN_CLUSTER = "yarn-cluster";
public static final String FLINK_RUN_MODE = "-m"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String FLINK_YARN_SLOT = "-ys";
public static final String FLINK_APP_NAME = "-ynm";
public static final String FLINK_QUEUE = "-yqu";
public static final String FLINK_TASK_MANAGE = "-yn";
public static final String FLINK_JOB_MANAGE_MEM = "-yjm";
public static final String FLINK_TASK_MANAGE_MEM = "-ytm";
public static final String FLINK_MAIN_CLASS = "-c";
public static final String FLINK_PARALLELISM = "-p";
public static final String FLINK_SHUTDOWN_ON_ATTACHED_EXIT = "-sae";
public static final int[] NOT_TERMINATED_STATES = new int[] {
ExecutionStatus.SUBMITTED_SUCCESS.ordinal(),
ExecutionStatus.RUNNING_EXECUTION.ordinal(),
ExecutionStatus.DELAY_EXECUTION.ordinal(),
ExecutionStatus.READY_PAUSE.ordinal(),
ExecutionStatus.READY_STOP.ordinal(),
ExecutionStatus.NEED_FAULT_TOLERANCE.ordinal(),
ExecutionStatus.WAITTING_THREAD.ordinal(),
ExecutionStatus.WAITTING_DEPEND.ordinal()
};
/**
* status
*/
public static final String STATUS = "status";
/**
* message
*/
public static final String MSG = "msg";
/**
* data total
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String COUNT = "count";
/**
* page size
*/
public static final String PAGE_SIZE = "pageSize";
/**
* current page no
*/
public static final String PAGE_NUMBER = "pageNo";
/**
*
*/
public static final String DATA_LIST = "data";
public static final String TOTAL_LIST = "totalList";
public static final String CURRENT_PAGE = "currentPage";
public static final String TOTAL_PAGE = "totalPage";
public static final String TOTAL = "total";
/**
* workflow
*/
public static final String WORKFLOW_LIST = "workFlowList";
public static final String WORKFLOW_RELATION_LIST = "workFlowRelationList";
/**
* session user
*/
public static final String SESSION_USER = "session.user";
public static final String SESSION_ID = "sessionId";
public static final String PASSWORD_DEFAULT = "******";
/**
* locale |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | */
public static final String LOCALE_LANGUAGE = "language";
/**
* driver
*/
public static final String ORG_POSTGRESQL_DRIVER = "org.postgresql.Driver";
public static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver";
public static final String ORG_APACHE_HIVE_JDBC_HIVE_DRIVER = "org.apache.hive.jdbc.HiveDriver";
public static final String COM_CLICKHOUSE_JDBC_DRIVER = "ru.yandex.clickhouse.ClickHouseDriver";
public static final String COM_ORACLE_JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
public static final String COM_SQLSERVER_JDBC_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
public static final String COM_DB2_JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver";
public static final String COM_PRESTO_JDBC_DRIVER = "com.facebook.presto.jdbc.PrestoDriver";
/**
* database type
*/
public static final String MYSQL = "MYSQL";
public static final String POSTGRESQL = "POSTGRESQL";
public static final String HIVE = "HIVE";
public static final String SPARK = "SPARK";
public static final String CLICKHOUSE = "CLICKHOUSE";
public static final String ORACLE = "ORACLE";
public static final String SQLSERVER = "SQLSERVER";
public static final String DB2 = "DB2";
public static final String PRESTO = "PRESTO";
/**
* jdbc url
*/
public static final String JDBC_MYSQL = "jdbc:mysql://";
public static final String JDBC_POSTGRESQL = "jdbc:postgresql://"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | public static final String JDBC_HIVE_2 = "jdbc:hive2://";
public static final String JDBC_CLICKHOUSE = "jdbc:clickhouse://";
public static final String JDBC_ORACLE_SID = "jdbc:oracle:thin:@";
public static final String JDBC_ORACLE_SERVICE_NAME = "jdbc:oracle:thin:@//";
public static final String JDBC_SQLSERVER = "jdbc:sqlserver://";
public static final String JDBC_DB2 = "jdbc:db2://";
public static final String JDBC_PRESTO = "jdbc:presto://";
public static final String ADDRESS = "address";
public static final String DATABASE = "database";
public static final String JDBC_URL = "jdbcUrl";
public static final String PRINCIPAL = "principal";
public static final String OTHER = "other";
public static final String ORACLE_DB_CONNECT_TYPE = "connectType";
public static final String KERBEROS_KRB5_CONF_PATH = "javaSecurityKrb5Conf";
public static final String KERBEROS_KEY_TAB_USERNAME = "loginUserKeytabUsername";
public static final String KERBEROS_KEY_TAB_PATH = "loginUserKeytabPath";
/**
* session timeout
*/
public static final int SESSION_TIME_OUT = 7200;
public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024;
public static final String UDF = "UDF";
public static final String CLASS = "class";
public static final String RECEIVERS = "receivers";
public static final String RECEIVERS_CC = "receiversCc";
/**
* dataSource sensitive param
*/
public static final String DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))";
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | * default worker group
*/
public static final String DEFAULT_WORKER_GROUP = "default";
public static final Integer TASK_INFO_LENGTH = 5;
/**
* new
* schedule time
*/
public static final String PARAMETER_SHECDULE_TIME = "schedule.time";
/**
* authorize writable perm
*/
public static final int AUTHORIZE_WRITABLE_PERM = 7;
/**
* authorize readable perm
*/
public static final int AUTHORIZE_READABLE_PERM = 4;
/**
* plugin configurations
*/
public static final String PLUGIN_JAR_SUFFIX = ".jar";
public static final int NORMAL_NODE_STATUS = 0;
public static final int ABNORMAL_NODE_STATUS = 1;
public static final String START_TIME = "start time";
public static final String END_TIME = "end time";
public static final String START_END_DATE = "startDate,endDate";
/**
* system line separator
*/
public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java | /**
* net system properties
*/
public static final String DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE = "dolphin.scheduler.network.interface.preferred";
public static final String EXCEL_SUFFIX_XLS = ".xls";
/**
* datasource encryption salt
*/
public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*";
public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable";
public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt";
/**
* Network IP gets priority, default inner outer
*/
public static final String NETWORK_PRIORITY_STRATEGY = "dolphin.scheduler.network.priority.strategy";
/**
* exec shell scripts
*/
public static final String SH = "sh";
/**
* pstree, get pud and sub pid
*/
public static final String PSTREE = "pstree";
/**
* docker & kubernetes
*/
public static final boolean DOCKER_MODE = StringUtils.isNotEmpty(System.getenv("DOCKER"));
public static final boolean KUBERNETES_MODE = StringUtils.isNotEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && StringUtils.isNotEmpty(System.getenv("KUBERNETES_SERVICE_PORT"));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.shell.ShellExecutor;
import org.apache.commons.configuration.Configuration;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.lang.management.RuntimeMXBean;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import oshi.SystemInfo;
import oshi.hardware.CentralProcessor;
import oshi.hardware.GlobalMemory;
import oshi.hardware.HardwareAbstractionLayer;
/**
* os utils
*/
public class OSUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | private static final Logger logger = LoggerFactory.getLogger(OSUtils.class);
public static final ThreadLocal<Logger> taskLoggerThreadLocal = new ThreadLocal<>();
private static final SystemInfo SI = new SystemInfo();
public static final String TWO_DECIMAL = "0.00";
/**
* return -1 when the function can not get hardware env info
* e.g {@link OSUtils#loadAverage()} {@link OSUtils#cpuUsage()}
*/
public static final double NEGATIVE_ONE = -1;
private static HardwareAbstractionLayer hal = SI.getHardware();
private OSUtils() {
throw new UnsupportedOperationException("Construct OSUtils");
}
/**
* Initialization regularization, solve the problem of pre-compilation performance,
* avoid the thread safety problem of multi-thread operation
*/
private static final Pattern PATTERN = Pattern.compile("\\s+");
/**
* get memory usage
* Keep 2 decimal
*
* @return percent %
*/
public static double memoryUsage() {
GlobalMemory memory = hal.getMemory();
double memoryUsage = (memory.getTotal() - memory.getAvailable() - memory.getSwapUsed()) * 0.1 / memory.getTotal() * 10;
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | return Double.parseDouble(df.format(memoryUsage));
}
/**
* get available physical memory size
* <p>
* Keep 2 decimal
*
* @return available Physical Memory Size, unit: G
*/
public static double availablePhysicalMemorySize() {
GlobalMemory memory = hal.getMemory();
double availablePhysicalMemorySize = (memory.getAvailable() + memory.getSwapUsed()) / 1024.0 / 1024 / 1024;
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(availablePhysicalMemorySize));
}
/**
* get total physical memory size
* <p>
* Keep 2 decimal
*
* @return available Physical Memory Size, unit: G
*/
public static double totalMemorySize() {
GlobalMemory memory = hal.getMemory();
double availablePhysicalMemorySize = memory.getTotal() / 1024.0 / 1024 / 1024;
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(availablePhysicalMemorySize));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | /**
* load average
*
* @return load average
*/
public static double loadAverage() {
double loadAverage;
try {
OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
loadAverage = osBean.getSystemLoadAverage();
} catch (Exception e) {
logger.error("get operation system load average exception, try another method ", e);
loadAverage = hal.getProcessor().getSystemLoadAverage();
if (Double.isNaN(loadAverage)) {
return NEGATIVE_ONE;
}
}
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(loadAverage));
}
/**
* get cpu usage
*
* @return cpu usage
*/
public static double cpuUsage() {
CentralProcessor processor = hal.getProcessor();
double cpuUsage = processor.getSystemCpuLoad();
if (Double.isNaN(cpuUsage)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | return NEGATIVE_ONE;
}
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(cpuUsage));
}
public static List<String> getUserList() {
try {
if (isMacOS()) {
return getUserListFromMac();
} else if (isWindows()) {
return getUserListFromWindows();
} else {
return getUserListFromLinux();
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return Collections.emptyList();
}
/**
* get user list from linux
*
* @return user list
*/
private static List<String> getUserListFromLinux() throws IOException {
List<String> userList = new ArrayList<>();
try (BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(new FileInputStream("/etc/passwd")))) {
String line; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | while ((line = bufferedReader.readLine()) != null) {
if (line.contains(":")) {
String[] userInfo = line.split(":");
userList.add(userInfo[0]);
}
}
}
return userList;
}
/**
* get user list from mac
*
* @return user list
*/
private static List<String> getUserListFromMac() throws IOException {
String result = exeCmd("dscl . list /users");
if (StringUtils.isNotEmpty(result)) {
return Arrays.asList(result.split("\n"));
}
return Collections.emptyList();
}
/**
* get user list from windows
*
* @return user list
*/
private static List<String> getUserListFromWindows() throws IOException {
String result = exeCmd("net user");
String[] lines = result.split("\n");
int startPos = 0; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | int endPos = lines.length - 2;
for (int i = 0; i < lines.length; i++) {
if (lines[i].isEmpty()) {
continue;
}
int count = 0;
if (lines[i].charAt(0) == '-') {
for (int j = 0; j < lines[i].length(); j++) {
if (lines[i].charAt(i) == '-') {
count++;
}
}
}
if (count == lines[i].length()) {
startPos = i + 1;
break;
}
}
List<String> users = new ArrayList<>();
while (startPos <= endPos) {
users.addAll(Arrays.asList(PATTERN.split(lines[startPos])));
startPos++;
}
return users;
}
/**
* create user
*
* @param userName user name
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | public static void createUserIfAbsent(String userName) {
taskLoggerThreadLocal.set(taskLoggerThreadLocal.get());
if (!getUserList().contains(userName)) {
boolean isSuccess = createUser(userName);
String infoLog = String.format("create user %s %s", userName, isSuccess ? "success" : "fail");
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog);
}
taskLoggerThreadLocal.remove();
}
/**
* create user
*
* @param userName user name
* @return true if creation was successful, otherwise false
*/
public static boolean createUser(String userName) {
try {
String userGroup = getGroup();
if (StringUtils.isEmpty(userGroup)) {
String errorLog = String.format("%s group does not exist for this operating system.", userGroup);
LoggerUtils.logError(Optional.ofNullable(logger), errorLog);
LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), errorLog);
return false;
}
if (isMacOS()) {
createMacUser(userName, userGroup);
} else if (isWindows()) {
createWindowsUser(userName, userGroup); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | } else {
createLinuxUser(userName, userGroup);
}
return true;
} catch (Exception e) {
LoggerUtils.logError(Optional.ofNullable(logger), e);
LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), e);
}
return false;
}
/**
* create linux user
*
* @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
private static void createLinuxUser(String userName, String userGroup) throws IOException {
String infoLog1 = String.format("create linux os user : %s", userName);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1);
String cmd = String.format("sudo useradd -g %s %s", userGroup, userName);
String infoLog2 = String.format("execute cmd : %s", cmd);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2);
exeCmd(cmd);
}
/**
* create mac user (Supports Mac OSX 10.10+)
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | * @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
private static void createMacUser(String userName, String userGroup) throws IOException {
Optional<Logger> optionalLogger = Optional.ofNullable(logger);
Optional<Logger> optionalTaskLogger = Optional.ofNullable(taskLoggerThreadLocal.get());
String infoLog1 = String.format("create mac os user : %s", userName);
LoggerUtils.logInfo(optionalLogger, infoLog1);
LoggerUtils.logInfo(optionalTaskLogger, infoLog1);
String createUserCmd = String.format("sudo sysadminctl -addUser %s -password %s", userName, userName);
String infoLog2 = String.format("create user command : %s", createUserCmd);
LoggerUtils.logInfo(optionalLogger, infoLog2);
LoggerUtils.logInfo(optionalTaskLogger, infoLog2);
exeCmd(createUserCmd);
String appendGroupCmd = String.format("sudo dseditgroup -o edit -a %s -t user %s", userName, userGroup);
String infoLog3 = String.format("append user to group : %s", appendGroupCmd);
LoggerUtils.logInfo(optionalLogger, infoLog3);
LoggerUtils.logInfo(optionalTaskLogger, infoLog3);
exeCmd(appendGroupCmd);
}
/**
* create windows user
*
* @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
private static void createWindowsUser(String userName, String userGroup) throws IOException {
String infoLog1 = String.format("create windows os user : %s", userName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1);
String userCreateCmd = String.format("net user \"%s\" /add", userName);
String infoLog2 = String.format("execute create user command : %s", userCreateCmd);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2);
exeCmd(userCreateCmd);
String appendGroupCmd = String.format("net localgroup \"%s\" \"%s\" /add", userGroup, userName);
String infoLog3 = String.format("execute append user to group : %s", appendGroupCmd);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog3);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog3);
exeCmd(appendGroupCmd);
}
/**
* get system group information
*
* @return system group info
* @throws IOException errors
*/
public static String getGroup() throws IOException {
if (isWindows()) {
String currentProcUserName = System.getProperty("user.name");
String result = exeCmd(String.format("net user \"%s\"", currentProcUserName));
String line = result.split("\n")[22];
String group = PATTERN.split(line)[1];
if (group.charAt(0) == '*') {
return group.substring(1);
} else {
return group;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | } else {
String result = exeCmd("groups");
if (StringUtils.isNotEmpty(result)) {
String[] groupInfo = result.split(" ");
return groupInfo[0];
}
}
return null;
}
/**
* get sudo command
*
* @param tenantCode tenantCode
* @param command command
* @return result of sudo execute command
*/
public static String getSudoCmd(String tenantCode, String command) {
if (!CommonUtils.isSudoEnable() || StringUtils.isEmpty(tenantCode)) {
return command;
}
return String.format("sudo -u %s %s", tenantCode, command);
}
/**
* Execute the corresponding command of Linux or Windows
*
* @param command command
* @return result of execute command
* @throws IOException errors
*/
public static String exeCmd(String command) throws IOException { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | StringTokenizer st = new StringTokenizer(command);
String[] cmdArray = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++) {
cmdArray[i] = st.nextToken();
}
return exeShell(cmdArray);
}
/**
* Execute the shell
*
* @param command command
* @return result of execute the shell
* @throws IOException errors
*/
public static String exeShell(String[] command) throws IOException {
return ShellExecutor.execCommand(command);
}
/**
* get process id
*
* @return process id
*/
public static int getProcessID() {
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
return Integer.parseInt(runtimeMXBean.getName().split("@")[0]);
}
/**
* whether is macOS
*
* @return true if mac |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | */
public static boolean isMacOS() {
return getOSName().startsWith("Mac");
}
/**
* whether is windows
*
* @return true if windows
*/
public static boolean isWindows() {
return getOSName().startsWith("Windows");
}
/**
* get current OS name
*
* @return current OS name
*/
public static String getOSName() {
return System.getProperty("os.name");
}
/**
* check memory and cpu usage
*
* @param systemCpuLoad systemCpuLoad
* @param systemReservedMemory systemReservedMemory
* @return check memory and cpu usage
*/
public static Boolean checkResource(double systemCpuLoad, double systemReservedMemory) {
double loadAverage = loadAverage(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | double availablePhysicalMemorySize = availablePhysicalMemorySize();
if (loadAverage > systemCpuLoad || availablePhysicalMemorySize < systemReservedMemory) {
logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize, loadAverage);
return false;
} else {
return true;
}
}
/**
* check memory and cpu usage
*
* @param conf conf
* @param isMaster is master
* @return check memory and cpu usage
*/
public static Boolean checkResource(Configuration conf, Boolean isMaster) {
double systemCpuLoad;
double systemReservedMemory;
if (Boolean.TRUE.equals(isMaster)) {
systemCpuLoad = conf.getDouble(Constants.MASTER_MAX_CPULOAD_AVG, Constants.DEFAULT_MASTER_CPU_LOAD);
systemReservedMemory = conf.getDouble(Constants.MASTER_RESERVED_MEMORY, Constants.DEFAULT_MASTER_RESERVED_MEMORY);
} else {
systemCpuLoad = conf.getDouble(Constants.WORKER_MAX_CPULOAD_AVG, Constants.DEFAULT_WORKER_CPU_LOAD);
systemReservedMemory = conf.getDouble(Constants.WORKER_RESERVED_MEMORY, Constants.DEFAULT_WORKER_RESERVED_MEMORY);
}
return checkResource(systemCpuLoad, systemReservedMemory);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.os;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import oshi.hardware.GlobalMemory;
import java.math.RoundingMode;
import java.text.DecimalFormat;
/**
* OSUtilsTest
*/
public class OSUtilsTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java | private static Logger logger = LoggerFactory.getLogger(OSUtilsTest.class);
@Test
public void memoryUsage() {
logger.info("memoryUsage : {}", OSUtils.memoryUsage());
}
@Test
public void availablePhysicalMemorySize() {
logger.info("availablePhysicalMemorySize : {}", OSUtils.availablePhysicalMemorySize());
logger.info("availablePhysicalMemorySize : {}", OSUtils.totalMemorySize() / 10);
}
@Test
public void loadAverage() {
logger.info("memoryUsage : {}", OSUtils.loadAverage());
}
private void printMemory(GlobalMemory memory) {
logger.info("memoryUsage : {} %" , (memory.getTotal() - memory.getAvailable()) * 100 / memory.getTotal() );
}
@Test
public void cpuUsage() throws Exception {
logger.info("cpuUsage : {}", OSUtils.cpuUsage());
Thread.sleep(1000L);
logger.info("cpuUsage : {}", OSUtils.cpuUsage());
double cpuUsage = OSUtils.cpuUsage();
DecimalFormat df = new DecimalFormat("0.00");
df.setRoundingMode(RoundingMode.HALF_UP);
logger.info("cpuUsage1 : {}", df.format(cpuUsage));
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.PropertiesConfiguration;
import java.io.IOException;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OSUtilsTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java | private static final Logger logger = LoggerFactory.getLogger(OSUtilsTest.class);
@Test
public void getUserList() {
List<String> userList = OSUtils.getUserList();
Assert.assertNotEquals("System user list should not be empty", userList.size(), 0); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java | logger.info("OS user list : {}", userList.toString());
}
@Test
public void testOSMetric(){
if (!OSUtils.isWindows()) {
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize();
Assert.assertTrue(availablePhysicalMemorySize >= 0.0d);
double totalMemorySize = OSUtils.totalMemorySize();
Assert.assertTrue(totalMemorySize >= 0.0d);
double loadAverage = OSUtils.loadAverage();
logger.info("loadAverage {}", loadAverage);
double memoryUsage = OSUtils.memoryUsage();
Assert.assertTrue(memoryUsage >= 0.0d);
double cpuUsage = OSUtils.cpuUsage();
Assert.assertTrue(cpuUsage >= 0.0d || cpuUsage == -1.0d);
} else {
}
}
@Test
public void getGroup() {
try {
String group = OSUtils.getGroup();
Assert.assertNotNull(group);
} catch (IOException e) {
Assert.fail("get group failed " + e.getMessage());
}
}
@Test
public void createUser() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java | boolean result = OSUtils.createUser("test123");
if (result) {
Assert.assertTrue("create user test123 success", true);
} else {
Assert.assertTrue("create user test123 fail", true);
}
}
@Test
public void createUserIfAbsent() {
OSUtils.createUserIfAbsent("test123");
Assert.assertTrue("create user test123 success", true);
}
@Test
public void testGetSudoCmd() {
String cmd = "kill -9 1234";
String sudoCmd = OSUtils.getSudoCmd("test123", cmd);
Assert.assertEquals("sudo -u test123 " + cmd, sudoCmd);
}
@Test
public void exeCmd() {
if(OSUtils.isMacOS() || !OSUtils.isWindows()){
try {
String result = OSUtils.exeCmd("echo helloWorld");
Assert.assertEquals("helloWorld\n",result);
} catch (IOException e) {
Assert.fail("exeCmd " + e.getMessage());
}
}
}
@Test |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,309 | [Bug][Common] memoryUsage is `-33%` | **To Reproduce**
`memoryUsage` is `-33%`
**Expected behavior**
Bug fixed
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.x]
-[dev]
| https://github.com/apache/dolphinscheduler/issues/5309 | https://github.com/apache/dolphinscheduler/pull/5312 | 5ef1f731b7f3b48915859b7a9595ec42df614c48 | e92e29ef9a126d1d5660011545056d4dd806d105 | "2021-04-16T15:51:04Z" | java | "2021-04-19T02:24:54Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java | public void getProcessID(){
int processId = OSUtils.getProcessID();
Assert.assertNotEquals(0, processId);
}
@Test
public void checkResource(){
boolean resource = OSUtils.checkResource(100,0);
Assert.assertTrue(resource);
resource = OSUtils.checkResource(0,Double.MAX_VALUE);
Assert.assertFalse(resource);
Configuration configuration = new PropertiesConfiguration();
configuration.setProperty(Constants.MASTER_MAX_CPULOAD_AVG,100);
configuration.setProperty(Constants.MASTER_RESERVED_MEMORY,0);
resource = OSUtils.checkResource(configuration,true);
Assert.assertTrue(resource);
configuration.setProperty(Constants.MASTER_MAX_CPULOAD_AVG,0);
configuration.setProperty(Constants.MASTER_RESERVED_MEMORY,Double.MAX_VALUE);
resource = OSUtils.checkResource(configuration,true);
Assert.assertFalse(resource);
configuration.setProperty(Constants.WORKER_MAX_CPULOAD_AVG,100);
configuration.setProperty(Constants.WORKER_RESERVED_MEMORY,0);
resource = OSUtils.checkResource(configuration,false);
Assert.assertTrue(resource);
configuration.setProperty(Constants.WORKER_MAX_CPULOAD_AVG,0);
configuration.setProperty(Constants.WORKER_RESERVED_MEMORY,Double.MAX_VALUE);
resource = OSUtils.checkResource(configuration,false);
Assert.assertFalse(resource);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.shell.ShellExecutor;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | import java.lang.management.RuntimeMXBean;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import oshi.SystemInfo;
import oshi.hardware.CentralProcessor;
import oshi.hardware.GlobalMemory;
import oshi.hardware.HardwareAbstractionLayer;
/**
* os utils
*/
public class OSUtils {
private static final Logger logger = LoggerFactory.getLogger(OSUtils.class);
public static final ThreadLocal<Logger> taskLoggerThreadLocal = new ThreadLocal<>();
private static final SystemInfo SI = new SystemInfo();
public static final String TWO_DECIMAL = "0.00";
/**
* return -1 when the function can not get hardware env info
* e.g {@link OSUtils#loadAverage()} {@link OSUtils#cpuUsage()}
*/
public static final double NEGATIVE_ONE = -1;
private static HardwareAbstractionLayer hal = SI.getHardware(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | private OSUtils() {
throw new UnsupportedOperationException("Construct OSUtils");
}
/**
* Initialization regularization, solve the problem of pre-compilation performance,
* avoid the thread safety problem of multi-thread operation
*/
private static final Pattern PATTERN = Pattern.compile("\\s+");
/**
* get memory usage
* Keep 2 decimal
*
* @return percent %
*/
public static double memoryUsage() {
GlobalMemory memory = hal.getMemory();
double memoryUsage = (memory.getTotal() - memory.getAvailable()) * 1.0 / memory.getTotal();
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(memoryUsage));
}
/**
* get available physical memory size
* <p>
* Keep 2 decimal
*
* @return available Physical Memory Size, unit: G
*/
public static double availablePhysicalMemorySize() {
GlobalMemory memory = hal.getMemory(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | double availablePhysicalMemorySize = memory.getAvailable() / 1024.0 / 1024 / 1024;
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(availablePhysicalMemorySize));
}
/**
* get total physical memory size
* <p>
* Keep 2 decimal
*
* @return available Physical Memory Size, unit: G
*/
public static double totalPhysicalMemorySize() {
GlobalMemory memory = hal.getMemory();
double totalPhysicalMemorySize = memory.getTotal() / 1024.0 / 1024 / 1024;
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(totalPhysicalMemorySize));
}
/**
* load average
*
* @return load average
*/
public static double loadAverage() {
double loadAverage;
try {
OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
loadAverage = osBean.getSystemLoadAverage();
} catch (Exception e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | logger.error("get operation system load average exception, try another method ", e);
loadAverage = hal.getProcessor().getSystemLoadAverage();
if (Double.isNaN(loadAverage)) {
return NEGATIVE_ONE;
}
}
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(loadAverage));
}
/**
* get cpu usage
*
* @return cpu usage
*/
public static double cpuUsage() {
CentralProcessor processor = hal.getProcessor();
double cpuUsage = processor.getSystemCpuLoad();
if (Double.isNaN(cpuUsage)) {
return NEGATIVE_ONE;
}
DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP);
return Double.parseDouble(df.format(cpuUsage));
}
public static List<String> getUserList() {
try {
if (isMacOS()) {
return getUserListFromMac();
} else if (isWindows()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | return getUserListFromWindows();
} else {
return getUserListFromLinux();
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return Collections.emptyList();
}
/**
* get user list from linux
*
* @return user list
*/
private static List<String> getUserListFromLinux() throws IOException {
List<String> userList = new ArrayList<>();
try (BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(new FileInputStream("/etc/passwd")))) {
String line;
while ((line = bufferedReader.readLine()) != null) {
if (line.contains(":")) {
String[] userInfo = line.split(":");
userList.add(userInfo[0]);
}
}
}
return userList;
}
/**
* get user list from mac |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | *
* @return user list
*/
private static List<String> getUserListFromMac() throws IOException {
String result = exeCmd("dscl . list /users");
if (StringUtils.isNotEmpty(result)) {
return Arrays.asList(result.split("\n"));
}
return Collections.emptyList();
}
/**
* get user list from windows
*
* @return user list
*/
private static List<String> getUserListFromWindows() throws IOException {
String result = exeCmd("net user");
String[] lines = result.split("\n");
int startPos = 0;
int endPos = lines.length - 2;
for (int i = 0; i < lines.length; i++) {
if (lines[i].isEmpty()) {
continue;
}
int count = 0;
if (lines[i].charAt(0) == '-') {
for (int j = 0; j < lines[i].length(); j++) {
if (lines[i].charAt(i) == '-') {
count++;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | }
}
if (count == lines[i].length()) {
startPos = i + 1;
break;
}
}
List<String> users = new ArrayList<>();
while (startPos <= endPos) {
users.addAll(Arrays.asList(PATTERN.split(lines[startPos])));
startPos++;
}
return users;
}
/**
* create user
*
* @param userName user name
*/
public static void createUserIfAbsent(String userName) {
taskLoggerThreadLocal.set(taskLoggerThreadLocal.get());
if (!getUserList().contains(userName)) {
boolean isSuccess = createUser(userName);
String infoLog = String.format("create user %s %s", userName, isSuccess ? "success" : "fail");
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog);
}
taskLoggerThreadLocal.remove();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | /**
* create user
*
* @param userName user name
* @return true if creation was successful, otherwise false
*/
public static boolean createUser(String userName) {
try {
String userGroup = getGroup();
if (StringUtils.isEmpty(userGroup)) {
String errorLog = String.format("%s group does not exist for this operating system.", userGroup);
LoggerUtils.logError(Optional.ofNullable(logger), errorLog);
LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), errorLog);
return false;
}
if (isMacOS()) {
createMacUser(userName, userGroup);
} else if (isWindows()) {
createWindowsUser(userName, userGroup);
} else {
createLinuxUser(userName, userGroup);
}
return true;
} catch (Exception e) {
LoggerUtils.logError(Optional.ofNullable(logger), e);
LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), e);
}
return false;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | * create linux user
*
* @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
private static void createLinuxUser(String userName, String userGroup) throws IOException {
String infoLog1 = String.format("create linux os user : %s", userName);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1);
String cmd = String.format("sudo useradd -g %s %s", userGroup, userName);
String infoLog2 = String.format("execute cmd : %s", cmd);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2);
exeCmd(cmd);
}
/**
* create mac user (Supports Mac OSX 10.10+)
*
* @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
private static void createMacUser(String userName, String userGroup) throws IOException {
Optional<Logger> optionalLogger = Optional.ofNullable(logger);
Optional<Logger> optionalTaskLogger = Optional.ofNullable(taskLoggerThreadLocal.get());
String infoLog1 = String.format("create mac os user : %s", userName);
LoggerUtils.logInfo(optionalLogger, infoLog1);
LoggerUtils.logInfo(optionalTaskLogger, infoLog1);
String createUserCmd = String.format("sudo sysadminctl -addUser %s -password %s", userName, userName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | String infoLog2 = String.format("create user command : %s", createUserCmd);
LoggerUtils.logInfo(optionalLogger, infoLog2);
LoggerUtils.logInfo(optionalTaskLogger, infoLog2);
exeCmd(createUserCmd);
String appendGroupCmd = String.format("sudo dseditgroup -o edit -a %s -t user %s", userName, userGroup);
String infoLog3 = String.format("append user to group : %s", appendGroupCmd);
LoggerUtils.logInfo(optionalLogger, infoLog3);
LoggerUtils.logInfo(optionalTaskLogger, infoLog3);
exeCmd(appendGroupCmd);
}
/**
* create windows user
*
* @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
private static void createWindowsUser(String userName, String userGroup) throws IOException {
String infoLog1 = String.format("create windows os user : %s", userName);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1);
String userCreateCmd = String.format("net user \"%s\" /add", userName);
String infoLog2 = String.format("execute create user command : %s", userCreateCmd);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2);
exeCmd(userCreateCmd);
String appendGroupCmd = String.format("net localgroup \"%s\" \"%s\" /add", userGroup, userName);
String infoLog3 = String.format("execute append user to group : %s", appendGroupCmd);
LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog3);
LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog3); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | exeCmd(appendGroupCmd);
}
/**
* get system group information
*
* @return system group info
* @throws IOException errors
*/
public static String getGroup() throws IOException {
if (isWindows()) {
String currentProcUserName = System.getProperty("user.name");
String result = exeCmd(String.format("net user \"%s\"", currentProcUserName));
String line = result.split("\n")[22];
String group = PATTERN.split(line)[1];
if (group.charAt(0) == '*') {
return group.substring(1);
} else {
return group;
}
} else {
String result = exeCmd("groups");
if (StringUtils.isNotEmpty(result)) {
String[] groupInfo = result.split(" ");
return groupInfo[0];
}
}
return null;
}
/**
* get sudo command |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | *
* @param tenantCode tenantCode
* @param command command
* @return result of sudo execute command
*/
public static String getSudoCmd(String tenantCode, String command) {
if (!CommonUtils.isSudoEnable() || StringUtils.isEmpty(tenantCode)) {
return command;
}
return String.format("sudo -u %s %s", tenantCode, command);
}
/**
* Execute the corresponding command of Linux or Windows
*
* @param command command
* @return result of execute command
* @throws IOException errors
*/
public static String exeCmd(String command) throws IOException {
StringTokenizer st = new StringTokenizer(command);
String[] cmdArray = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++) {
cmdArray[i] = st.nextToken();
}
return exeShell(cmdArray);
}
/**
* Execute the shell
*
* @param command command |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | * @return result of execute the shell
* @throws IOException errors
*/
public static String exeShell(String[] command) throws IOException {
return ShellExecutor.execCommand(command);
}
/**
* get process id
*
* @return process id
*/
public static int getProcessID() {
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
return Integer.parseInt(runtimeMXBean.getName().split("@")[0]);
}
/**
* whether is macOS
*
* @return true if mac
*/
public static boolean isMacOS() {
return getOSName().startsWith("Mac");
}
/**
* whether is windows
*
* @return true if windows
*/
public static boolean isWindows() {
return getOSName().startsWith("Windows"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java | }
/**
* get current OS name
*
* @return current OS name
*/
public static String getOSName() {
return System.getProperty("os.name");
}
/**
* check memory and cpu usage
*
* @param systemCpuLoad systemCpuLoad
* @param systemReservedMemory systemReservedMemory
* @return check memory and cpu usage
*/
public static Boolean checkResource(double systemCpuLoad, double systemReservedMemory) {
double loadAverage = loadAverage();
double availablePhysicalMemorySize = availablePhysicalMemorySize();
if (loadAverage > systemCpuLoad || availablePhysicalMemorySize < systemReservedMemory) {
logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize, loadAverage);
return false;
} else {
return true;
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | */
package org.apache.dolphinscheduler.server.master.consumer;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.ResourceType;
import org.apache.dolphinscheduler.common.enums.SqoopJobType;
import org.apache.dolphinscheduler.common.enums.TaskType;
import org.apache.dolphinscheduler.common.enums.UdfType;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.process.ResourceInfo;
import org.apache.dolphinscheduler.common.task.AbstractParameters;
import org.apache.dolphinscheduler.common.task.datax.DataxParameters;
import org.apache.dolphinscheduler.common.task.procedure.ProcedureParameters;
import org.apache.dolphinscheduler.common.task.sql.SqlParameters;
import org.apache.dolphinscheduler.common.task.sqoop.SqoopParameters;
import org.apache.dolphinscheduler.common.task.sqoop.sources.SourceMysqlParameter;
import org.apache.dolphinscheduler.common.task.sqoop.targets.TargetMysqlParameter;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.EnumUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.common.utils.TaskParametersUtils;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder;
import org.apache.dolphinscheduler.server.entity.DataxTaskExecutionContext; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | import org.apache.dolphinscheduler.server.entity.ProcedureTaskExecutionContext;
import org.apache.dolphinscheduler.server.entity.SQLTaskExecutionContext;
import org.apache.dolphinscheduler.server.entity.SqoopTaskExecutionContext;
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher;
import org.apache.dolphinscheduler.server.master.dispatch.context.ExecutionContext;
import org.apache.dolphinscheduler.server.master.dispatch.enums.ExecutorType;
import org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.queue.TaskPriority;
import org.apache.dolphinscheduler.service.queue.TaskPriorityQueue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* TaskUpdateQueue consumer
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | public class TaskPriorityQueueConsumer extends Thread {
/**
* logger of TaskUpdateQueueConsumer
*/
private static final Logger logger = LoggerFactory.getLogger(TaskPriorityQueueConsumer.class);
/**
* taskUpdateQueue
*/
@Autowired
private TaskPriorityQueue<TaskPriority> taskPriorityQueue;
/**
* processService
*/
@Autowired
private ProcessService processService;
/**
* executor dispatcher
*/
@Autowired
private ExecutorDispatcher dispatcher; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | /**
* master config
*/
@Autowired
private MasterConfig masterConfig;
@PostConstruct
public void init() {
super.setName("TaskUpdateQueueConsumerThread");
super.start();
}
@Override
public void run() {
List<TaskPriority> failedDispatchTasks = new ArrayList<>();
while (Stopper.isRunning()) {
try {
int fetchTaskNum = masterConfig.getMasterDispatchTaskNumber();
failedDispatchTasks.clear();
for (int i = 0; i < fetchTaskNum; i++) {
TaskPriority taskPriority = taskPriorityQueue.poll(Constants.SLEEP_TIME_MILLIS, TimeUnit.MILLISECONDS);
if (Objects.isNull(taskPriority)) {
continue;
}
boolean dispatchResult = dispatch(taskPriority);
if (!dispatchResult) {
failedDispatchTasks.add(taskPriority);
}
}
if (!failedDispatchTasks.isEmpty()) {
for (TaskPriority dispatchFailedTask : failedDispatchTasks) {
taskPriorityQueue.put(dispatchFailedTask); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | }
if (taskPriorityQueue.size() <= failedDispatchTasks.size()) {
TimeUnit.MILLISECONDS.sleep(Constants.SLEEP_TIME_MILLIS);
}
}
} catch (Exception e) {
logger.error("dispatcher task error", e);
}
}
}
/**
* dispatch task
*
* @param taskPriority taskPriority
* @return result
*/
protected boolean dispatch(TaskPriority taskPriority) {
boolean result = false;
try {
int taskInstanceId = taskPriority.getTaskId();
TaskExecutionContext context = getTaskExecutionContext(taskInstanceId);
ExecutionContext executionContext = new ExecutionContext(context.toCommand(), ExecutorType.WORKER, context.getWorkerGroup());
if (taskInstanceIsFinalState(taskInstanceId)) {
return true;
} else {
result = dispatcher.dispatch(executionContext);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | } catch (ExecuteException e) {
logger.error("dispatch error", e);
}
return result;
}
/**
* taskInstance is final state
* success,failure,kill,stop,pause,threadwaiting is final state
*
* @param taskInstanceId taskInstanceId
* @return taskInstance is final state
*/
public Boolean taskInstanceIsFinalState(int taskInstanceId) {
TaskInstance taskInstance = processService.findTaskInstanceById(taskInstanceId);
return taskInstance.getState().typeIsFinished();
}
/**
* get TaskExecutionContext
*
* @param taskInstanceId taskInstanceId
* @return TaskExecutionContext
*/
protected TaskExecutionContext getTaskExecutionContext(int taskInstanceId) {
TaskInstance taskInstance = processService.getTaskInstanceDetailByTaskId(taskInstanceId);
// task type
TaskType taskType = TaskType.valueOf(taskInstance.getTaskType());
// task node
TaskNode taskNode = JSONUtils.parseObject(taskInstance.getTaskJson(), TaskNode.class);
Integer userId = taskInstance.getProcessDefine() == null ? 0 : taskInstance.getProcessDefine().getUserId();
Tenant tenant = processService.getTenantForProcess(taskInstance.getProcessInstance().getTenantId(), userId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | // verify tenant is null
if (verifyTenantIsNull(tenant, taskInstance)) {
processService.changeTaskState(taskInstance, ExecutionStatus.FAILURE,
taskInstance.getStartTime(),
taskInstance.getHost(),
null,
null,
taskInstance.getId());
return null;
}
// set queue for process instance, user-specified queue takes precedence over tenant queue
String userQueue = processService.queryUserQueueByProcessInstanceId(taskInstance.getProcessInstanceId());
taskInstance.getProcessInstance().setQueue(StringUtils.isEmpty(userQueue) ? tenant.getQueue() : userQueue);
taskInstance.getProcessInstance().setTenantCode(tenant.getTenantCode());
taskInstance.setResources(getResourceFullNames(taskNode));
SQLTaskExecutionContext sqlTaskExecutionContext = new SQLTaskExecutionContext();
DataxTaskExecutionContext dataxTaskExecutionContext = new DataxTaskExecutionContext();
ProcedureTaskExecutionContext procedureTaskExecutionContext = new ProcedureTaskExecutionContext();
SqoopTaskExecutionContext sqoopTaskExecutionContext = new SqoopTaskExecutionContext();
// SQL task
if (taskType == TaskType.SQL) {
setSQLTaskRelation(sqlTaskExecutionContext, taskNode);
}
// DATAX task
if (taskType == TaskType.DATAX) {
setDataxTaskRelation(dataxTaskExecutionContext, taskNode);
}
// procedure task
if (taskType == TaskType.PROCEDURE) {
setProcedureTaskRelation(procedureTaskExecutionContext, taskNode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | }
if (taskType == TaskType.SQOOP) {
setSqoopTaskRelation(sqoopTaskExecutionContext, taskNode);
}
return TaskExecutionContextBuilder.get()
.buildTaskInstanceRelatedInfo(taskInstance)
.buildProcessInstanceRelatedInfo(taskInstance.getProcessInstance())
.buildProcessDefinitionRelatedInfo(taskInstance.getProcessDefine())
.buildSQLTaskRelatedInfo(sqlTaskExecutionContext)
.buildDataxTaskRelatedInfo(dataxTaskExecutionContext)
.buildProcedureTaskRelatedInfo(procedureTaskExecutionContext)
.buildSqoopTaskRelatedInfo(sqoopTaskExecutionContext)
.create();
}
/**
* set procedure task relation
*
* @param procedureTaskExecutionContext procedureTaskExecutionContext
* @param taskNode taskNode
*/
private void setProcedureTaskRelation(ProcedureTaskExecutionContext procedureTaskExecutionContext, TaskNode taskNode) {
ProcedureParameters procedureParameters = JSONUtils.parseObject(taskNode.getParams(), ProcedureParameters.class);
int datasourceId = procedureParameters.getDatasource();
DataSource datasource = processService.findDataSourceById(datasourceId);
procedureTaskExecutionContext.setConnectionParams(datasource.getConnectionParams());
}
/**
* set datax task relation
*
* @param dataxTaskExecutionContext dataxTaskExecutionContext |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | * @param taskNode taskNode
*/
protected void setDataxTaskRelation(DataxTaskExecutionContext dataxTaskExecutionContext, TaskNode taskNode) {
DataxParameters dataxParameters = JSONUtils.parseObject(taskNode.getParams(), DataxParameters.class);
DataSource dbSource = processService.findDataSourceById(dataxParameters.getDataSource());
DataSource dbTarget = processService.findDataSourceById(dataxParameters.getDataTarget());
if (dbSource != null) {
dataxTaskExecutionContext.setDataSourceId(dataxParameters.getDataSource());
dataxTaskExecutionContext.setSourcetype(dbSource.getType().getCode());
dataxTaskExecutionContext.setSourceConnectionParams(dbSource.getConnectionParams());
}
if (dbTarget != null) {
dataxTaskExecutionContext.setDataTargetId(dataxParameters.getDataTarget());
dataxTaskExecutionContext.setTargetType(dbTarget.getType().getCode());
dataxTaskExecutionContext.setTargetConnectionParams(dbTarget.getConnectionParams());
}
}
/**
* set sqoop task relation
*
* @param sqoopTaskExecutionContext sqoopTaskExecutionContext
* @param taskNode taskNode
*/
private void setSqoopTaskRelation(SqoopTaskExecutionContext sqoopTaskExecutionContext, TaskNode taskNode) {
SqoopParameters sqoopParameters = JSONUtils.parseObject(taskNode.getParams(), SqoopParameters.class);
// sqoop job type is template set task relation
if (sqoopParameters.getJobType().equals(SqoopJobType.TEMPLATE.getDescp())) {
SourceMysqlParameter sourceMysqlParameter = JSONUtils.parseObject(sqoopParameters.getSourceParams(), SourceMysqlParameter.class);
TargetMysqlParameter targetMysqlParameter = JSONUtils.parseObject(sqoopParameters.getTargetParams(), TargetMysqlParameter.class);
DataSource dataSource = processService.findDataSourceById(sourceMysqlParameter.getSrcDatasource()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | DataSource dataTarget = processService.findDataSourceById(targetMysqlParameter.getTargetDatasource());
if (dataSource != null) {
sqoopTaskExecutionContext.setDataSourceId(dataSource.getId());
sqoopTaskExecutionContext.setSourcetype(dataSource.getType().getCode());
sqoopTaskExecutionContext.setSourceConnectionParams(dataSource.getConnectionParams());
}
if (dataTarget != null) {
sqoopTaskExecutionContext.setDataTargetId(dataTarget.getId());
sqoopTaskExecutionContext.setTargetType(dataTarget.getType().getCode());
sqoopTaskExecutionContext.setTargetConnectionParams(dataTarget.getConnectionParams());
}
}
}
/**
* set SQL task relation
*
* @param sqlTaskExecutionContext sqlTaskExecutionContext
* @param taskNode taskNode
*/
private void setSQLTaskRelation(SQLTaskExecutionContext sqlTaskExecutionContext, TaskNode taskNode) {
SqlParameters sqlParameters = JSONUtils.parseObject(taskNode.getParams(), SqlParameters.class);
int datasourceId = sqlParameters.getDatasource();
DataSource datasource = processService.findDataSourceById(datasourceId);
sqlTaskExecutionContext.setConnectionParams(datasource.getConnectionParams());
// whether udf type
boolean udfTypeFlag = EnumUtils.isValidEnum(UdfType.class, sqlParameters.getType())
&& StringUtils.isNotEmpty(sqlParameters.getUdfs());
if (udfTypeFlag) {
String[] udfFunIds = sqlParameters.getUdfs().split(",");
int[] udfFunIdsArray = new int[udfFunIds.length]; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | for (int i = 0; i < udfFunIds.length; i++) {
udfFunIdsArray[i] = Integer.parseInt(udfFunIds[i]);
}
List<UdfFunc> udfFuncList = processService.queryUdfFunListByIds(udfFunIdsArray);
Map<UdfFunc, String> udfFuncMap = new HashMap<>();
for (UdfFunc udfFunc : udfFuncList) {
String tenantCode = processService.queryTenantCodeByResName(udfFunc.getResourceName(), ResourceType.UDF);
udfFuncMap.put(udfFunc, tenantCode);
}
sqlTaskExecutionContext.setUdfFuncTenantCodeMap(udfFuncMap);
}
}
/**
* whehter tenant is null
*
* @param tenant tenant
* @param taskInstance taskInstance
* @return result
*/
protected boolean verifyTenantIsNull(Tenant tenant, TaskInstance taskInstance) {
if (tenant == null) {
logger.error("tenant not exists,process instance id : {},task instance id : {}",
taskInstance.getProcessInstance().getId(),
taskInstance.getId());
return true;
}
return false;
}
/**
* get resource map key is full name and value is tenantCode |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | */
protected Map<String, String> getResourceFullNames(TaskNode taskNode) {
Map<String, String> resourcesMap = new HashMap<>();
AbstractParameters baseParam = TaskParametersUtils.getParameters(taskNode.getType(), taskNode.getParams());
if (baseParam != null) {
List<ResourceInfo> projectResourceFiles = baseParam.getResourceFilesList();
if (CollectionUtils.isNotEmpty(projectResourceFiles)) {
// filter
Set<ResourceInfo> oldVersionResources = projectResourceFiles.stream().filter(t -> t.getId() == 0).collect(Collectors.toSet());
if (CollectionUtils.isNotEmpty(oldVersionResources)) {
oldVersionResources.forEach(
(t) -> resourcesMap.put(t.getRes(), processService.queryTenantCodeByResName(t.getRes(), ResourceType.FILE))
);
}
// get the
Stream<Integer> resourceIdStream = projectResourceFiles.stream().map(resourceInfo -> resourceInfo.getId());
Set<Integer> resourceIdsSet = resourceIdStream.collect(Collectors.toSet());
if (CollectionUtils.isNotEmpty(resourceIdsSet)) {
Integer[] resourceIds = resourceIdsSet.toArray(new Integer[resourceIdsSet.size()]);
List<Resource> resources = processService.listResourceByIds(resourceIds);
resources.forEach(
(t) -> resourcesMap.put(t.getFullName(), processService.queryTenantCodeByResName(t.getFullName(), ResourceType.FILE))
);
}
}
}
return resourcesMap;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/ExecutorDispatcher.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.dispatch;
import org.apache.dolphinscheduler.common.utils.StringUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/ExecutorDispatcher.java | import org.apache.dolphinscheduler.remote.utils.Host;
import org.apache.dolphinscheduler.server.master.dispatch.context.ExecutionContext;
import org.apache.dolphinscheduler.server.master.dispatch.enums.ExecutorType;
import org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException;
import org.apache.dolphinscheduler.server.master.dispatch.executor.ExecutorManager;
import org.apache.dolphinscheduler.server.master.dispatch.executor.NettyExecutorManager;
import org.apache.dolphinscheduler.server.master.dispatch.host.HostManager;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.concurrent.ConcurrentHashMap;
/**
* executor dispatcher
*/
@Service
public class ExecutorDispatcher implements InitializingBean {
/**
* netty executor manager
*/
@Autowired
private NettyExecutorManager nettyExecutorManager;
/**
* round robin host manager
*/
@Autowired
private HostManager hostManager;
/**
* executor manager
*/
private final ConcurrentHashMap<ExecutorType, ExecutorManager<Boolean>> executorManagers; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/ExecutorDispatcher.java | /**
* constructor
*/
public ExecutorDispatcher(){
this.executorManagers = new ConcurrentHashMap<>();
}
/**
* task dispatch
*
* @param context context
* @return result
* @throws ExecuteException if error throws ExecuteException
*/
public Boolean dispatch(final ExecutionContext context) throws ExecuteException {
/**
* get executor manager
*/
ExecutorManager<Boolean> executorManager = this.executorManagers.get(context.getExecutorType());
if(executorManager == null){
throw new ExecuteException("no ExecutorManager for type : " + context.getExecutorType());
}
/**
* host select
*/
Host host = hostManager.select(context);
if (StringUtils.isEmpty(host.getAddress())) {
throw new ExecuteException(String.format("fail to execute : %s due to no suitable worker , " +
"current task need to %s worker group execute",
context.getCommand(),context.getWorkerGroup()));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/ExecutorDispatcher.java | context.setHost(host);
executorManager.beforeExecute(context);
try {
/**
* task execute
*/
return executorManager.execute(context);
} finally {
executorManager.afterExecute(context);
}
}
/**
* register init
* @throws Exception if error throws Exception
*/
@Override
public void afterPropertiesSet() throws Exception {
register(ExecutorType.WORKER, nettyExecutorManager);
register(ExecutorType.CLIENT, nettyExecutorManager);
}
/**
* register
* @param type executor type
* @param executorManager executorManager
*/
public void register(ExecutorType type, ExecutorManager executorManager){
executorManagers.put(type, executorManager);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | package org.apache.dolphinscheduler.server.master.dispatch.host;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.ResInfo;
import org.apache.dolphinscheduler.remote.utils.Host;
import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory;
import org.apache.dolphinscheduler.server.master.dispatch.context.ExecutionContext;
import org.apache.dolphinscheduler.server.master.dispatch.host.assign.HostWeight;
import org.apache.dolphinscheduler.server.master.dispatch.host.assign.HostWorker;
import org.apache.dolphinscheduler.server.master.dispatch.host.assign.LowerWeightRoundRobin;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* lower weight host manager
*/
public class LowerWeightHostManager extends CommonHostManager { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | private final Logger logger = LoggerFactory.getLogger(LowerWeightHostManager.class);
/**
* selector
*/
private LowerWeightRoundRobin selector;
/**
* worker host weights
*/
private ConcurrentHashMap<String, Set<HostWeight>> workerHostWeightsMap;
/**
* worker group host lock
*/
private Lock lock;
/**
* executor service
*/
private ScheduledExecutorService executorService;
@PostConstruct
public void init() {
this.selector = new LowerWeightRoundRobin(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | this.workerHostWeightsMap = new ConcurrentHashMap<>();
this.lock = new ReentrantLock();
this.executorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("LowerWeightHostManagerExecutor"));
this.executorService.scheduleWithFixedDelay(new RefreshResourceTask(),0, 5, TimeUnit.SECONDS);
}
@PreDestroy
public void close() {
this.executorService.shutdownNow();
}
/**
* select host
* @param context context
* @return host
*/
@Override
public Host select(ExecutionContext context) {
Set<HostWeight> workerHostWeights = getWorkerHostWeights(context.getWorkerGroup());
if (CollectionUtils.isNotEmpty(workerHostWeights)) {
return selector.select(workerHostWeights).getHost();
}
return new Host();
}
@Override
public HostWorker select(Collection<HostWorker> nodes) {
throw new UnsupportedOperationException("not support");
}
private void syncWorkerHostWeight(Map<String, Set<HostWeight>> workerHostWeights) {
lock.lock();
try {
workerHostWeightsMap.clear(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | workerHostWeightsMap.putAll(workerHostWeights);
} finally {
lock.unlock();
}
}
private Set<HostWeight> getWorkerHostWeights(String workerGroup) {
lock.lock();
try {
return workerHostWeightsMap.get(workerGroup);
} finally {
lock.unlock();
}
}
class RefreshResourceTask implements Runnable {
@Override
public void run() {
try {
Map<String, Set<HostWeight>> workerHostWeights = new HashMap<>();
Map<String, Set<String>> workerGroupNodes = serverNodeManager.getWorkerGroupNodes();
for (Map.Entry<String, Set<String>> entry : workerGroupNodes.entrySet()) {
String workerGroup = entry.getKey();
Set<String> nodes = entry.getValue();
Set<HostWeight> hostWeights = new HashSet<>(nodes.size());
for (String node : nodes) {
String heartbeat = serverNodeManager.getWorkerNodeInfo(node);
HostWeight hostWeight = getHostWeight(node, workerGroup, heartbeat);
if (hostWeight != null) {
hostWeights.add(hostWeight);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/dispatch/host/LowerWeightHostManager.java | if (!hostWeights.isEmpty()) {
workerHostWeights.put(workerGroup, hostWeights);
}
}
syncWorkerHostWeight(workerHostWeights);
} catch (Throwable ex) {
logger.error("RefreshResourceTask error", ex);
}
}
public HostWeight getHostWeight(String addr, String workerGroup, String heartbeat) {
if (ResInfo.isValidHeartbeatForZKInfo(heartbeat)) {
String[] parts = heartbeat.split(Constants.COMMA);
int status = Integer.parseInt(parts[8]);
if (status == Constants.ABNORMAL_NODE_STATUS) {
logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}",
Double.parseDouble(parts[3]), Double.parseDouble(parts[2]));
return null;
}
double cpu = Double.parseDouble(parts[0]);
double memory = Double.parseDouble(parts[1]);
double loadAverage = Double.parseDouble(parts[2]);
long startTime = DateUtils.stringToDate(parts[6]).getTime();
int weight = getWorkerHostWeightFromHeartbeat(heartbeat);
return new HostWeight(HostWorker.of(addr, weight, workerGroup), cpu, memory, loadAverage, startTime);
}
return null;
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/registry/HeartBeatTask.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.registry;
import static org.apache.dolphinscheduler.remote.utils.Constants.COMMA;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import java.util.Date;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Heart beat task
*/
public class HeartBeatTask implements Runnable { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/registry/HeartBeatTask.java | private final Logger logger = LoggerFactory.getLogger(HeartBeatTask.class);
private String startTime;
private double maxCpuloadAvg;
private double reservedMemory;
private int hostWeight;
private Set<String> heartBeatPaths;
private String serverType;
private ZookeeperRegistryCenter zookeeperRegistryCenter;
protected IStoppable stoppable = null;
public HeartBeatTask(String startTime,
double maxCpuloadAvg,
double reservedMemory,
Set<String> heartBeatPaths,
String serverType,
ZookeeperRegistryCenter zookeeperRegistryCenter) {
this.startTime = startTime;
this.maxCpuloadAvg = maxCpuloadAvg;
this.reservedMemory = reservedMemory;
this.heartBeatPaths = heartBeatPaths;
this.serverType = serverType;
this.zookeeperRegistryCenter = zookeeperRegistryCenter;
}
public HeartBeatTask(String startTime,
double maxCpuloadAvg,
double reservedMemory,
int hostWeight,
Set<String> heartBeatPaths,
String serverType, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/registry/HeartBeatTask.java | ZookeeperRegistryCenter zookeeperRegistryCenter) {
this.startTime = startTime;
this.maxCpuloadAvg = maxCpuloadAvg;
this.reservedMemory = reservedMemory;
this.hostWeight = hostWeight;
this.heartBeatPaths = heartBeatPaths;
this.serverType = serverType;
this.zookeeperRegistryCenter = zookeeperRegistryCenter;
}
@Override
public void run() {
try {
for (String heartBeatPath : heartBeatPaths) {
if (zookeeperRegistryCenter.checkIsDeadServer(heartBeatPath, serverType)) {
zookeeperRegistryCenter.getStoppable().stop("i was judged to death, release resources and stop myself");
return;
}
}
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize();
double loadAverage = OSUtils.loadAverage();
int status = Constants.NORMAL_NODE_STATUS;
if (availablePhysicalMemorySize < reservedMemory
|| loadAverage > maxCpuloadAvg) {
logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize, loadAverage);
status = Constants.ABNORMAL_NODE_STATUS;
}
StringBuilder builder = new StringBuilder(100);
builder.append(OSUtils.cpuUsage()).append(COMMA);
builder.append(OSUtils.memoryUsage()).append(COMMA); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,310 | [Improvement][Server] The log "load is too high or availablePhysicalMemorySize(G) is too low" is not clear | **Describe the question**
The log `load is too high or availablePhysicalMemorySize(G) is too low` is not clear
**What are the current deficiencies and the benefits of improvement**
- The updated log `current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G` will be more clear
**Which version of DolphinScheduler:**
-[1.3.x]
-[dev]
**Describe alternatives you've considered**
A clear and concise description of any alternative improvement solutions you've considered.
| https://github.com/apache/dolphinscheduler/issues/5310 | https://github.com/apache/dolphinscheduler/pull/5311 | e92e29ef9a126d1d5660011545056d4dd806d105 | 83519bdfc3a5cdd40f2d538d64ab6f8221bef246 | "2021-04-16T16:01:16Z" | java | "2021-04-19T02:29:32Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/registry/HeartBeatTask.java | builder.append(OSUtils.loadAverage()).append(COMMA);
builder.append(OSUtils.availablePhysicalMemorySize()).append(Constants.COMMA);
builder.append(maxCpuloadAvg).append(Constants.COMMA);
builder.append(reservedMemory).append(Constants.COMMA);
builder.append(startTime).append(Constants.COMMA);
builder.append(DateUtils.dateToString(new Date())).append(Constants.COMMA);
builder.append(status).append(COMMA);
builder.append(OSUtils.getProcessID());
if (Constants.WORKER_TYPE.equals(serverType)) {
builder.append(Constants.COMMA).append(hostWeight);
}
for (String heartBeatPath : heartBeatPaths) {
zookeeperRegistryCenter.getRegisterOperator().update(heartBeatPath, builder.toString());
}
} catch (Throwable ex) {
logger.error("error write heartbeat info", ex);
}
}
/**
* for stop server
*
* @param serverStoppable server stoppable interface
*/
public void setStoppable(IStoppable serverStoppable) {
this.stoppable = serverStoppable;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.runner;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.task.TaskTimeoutParameter;
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.queue.TaskPriority;
import org.apache.dolphinscheduler.service.queue.TaskPriorityQueue;
import org.apache.dolphinscheduler.service.queue.TaskPriorityQueueImpl;
import java.util.Date;
import java.util.concurrent.Callable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* master task exec base class
*/
public class MasterBaseTaskExecThread implements Callable<Boolean> {
/**
* logger of MasterBaseTaskExecThread
*/
protected Logger logger = LoggerFactory.getLogger(getClass());
/**
* process service
*/
protected ProcessService processService;
/**
* alert database access
*/
protected AlertDao alertDao; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | /**
* process instance
*/
protected ProcessInstance processInstance;
/**
* task instance
*/
protected TaskInstance taskInstance;
/**
* whether need cancel
*/
protected boolean cancel;
/**
* master config
*/
protected MasterConfig masterConfig;
/**
* taskUpdateQueue
*/
private TaskPriorityQueue taskUpdateQueue;
/**
* whether need check task time out.
*/
protected boolean checkTimeoutFlag = false;
/**
* task timeout parameters
*/
protected TaskTimeoutParameter taskTimeoutParameter;
/**
* constructor of MasterBaseTaskExecThread |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | *
* @param taskInstance task instance
*/
public MasterBaseTaskExecThread(TaskInstance taskInstance) {
this.processService = SpringApplicationContext.getBean(ProcessService.class);
this.alertDao = SpringApplicationContext.getBean(AlertDao.class);
this.cancel = false;
this.taskInstance = taskInstance;
this.masterConfig = SpringApplicationContext.getBean(MasterConfig.class);
this.taskUpdateQueue = SpringApplicationContext.getBean(TaskPriorityQueueImpl.class);
initTaskParams();
}
/**
* init task ordinary parameters
*/
private void initTaskParams() {
initTimeoutParams();
}
/**
* init task timeout parameters
*/
private void initTimeoutParams() {
String taskJson = taskInstance.getTaskJson();
TaskNode taskNode = JSONUtils.parseObject(taskJson, TaskNode.class);
taskTimeoutParameter = taskNode.getTaskTimeoutParameter();
if (taskTimeoutParameter.getEnable()) {
checkTimeoutFlag = true;
}
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | * get task instance
*
* @return TaskInstance
*/
public TaskInstance getTaskInstance() {
return this.taskInstance;
}
/**
* kill master base task exec thread
*/
public void kill() {
this.cancel = true;
}
/**
* submit master base task exec thread
*
* @return TaskInstance
*/
protected TaskInstance submit() {
Integer commitRetryTimes = masterConfig.getMasterTaskCommitRetryTimes();
Integer commitRetryInterval = masterConfig.getMasterTaskCommitInterval();
int retryTimes = 1;
boolean submitDB = false;
boolean submitTask = false;
TaskInstance task = null;
while (retryTimes <= commitRetryTimes) {
try {
if (!submitDB) {
task = processService.submitTask(taskInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | if (task != null && task.getId() != 0) {
submitDB = true;
}
}
if (submitDB && !submitTask) {
submitTask = dispatchTask(task);
}
if (submitDB && submitTask) {
return task;
}
if (!submitDB) {
logger.error("task commit to db failed , taskId {} has already retry {} times, please check the database", taskInstance.getId(), retryTimes);
} else if (!submitTask) {
logger.error("task commit failed , taskId {} has already retry {} times, please check", taskInstance.getId(), retryTimes);
}
Thread.sleep(commitRetryInterval);
} catch (Exception e) {
logger.error("task commit to mysql and dispatcht task failed", e);
}
retryTimes += 1;
}
return task;
}
/**
* dispatcht task
*
* @param taskInstance taskInstance
* @return whether submit task success
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | public Boolean dispatchTask(TaskInstance taskInstance) {
try {
if (taskInstance.isConditionsTask()
|| taskInstance.isDependTask()
|| taskInstance.isSubProcess()) {
return true;
}
if (taskInstance.getState().typeIsFinished()) {
logger.info(String.format("submit task , but task [%s] state [%s] is already finished. ", taskInstance.getName(), taskInstance.getState().toString()));
return true;
}
if (taskInstance.getState() == ExecutionStatus.RUNNING_EXECUTION
|| taskInstance.getState() == ExecutionStatus.DELAY_EXECUTION) {
logger.info("submit task, but the status of the task {} is already running or delayed.", taskInstance.getName());
return true;
}
logger.info("task ready to submit: {}", taskInstance);
/**
* taskPriority
*/
TaskPriority taskPriority = buildTaskPriority(processInstance.getProcessInstancePriority().getCode(),
processInstance.getId(),
taskInstance.getProcessInstancePriority().getCode(),
taskInstance.getId(),
org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP);
taskUpdateQueue.put(taskPriority);
logger.info(String.format("master submit success, task : %s", taskInstance.getName()));
return true;
} catch (Exception e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | logger.error("submit task Exception: ", e);
logger.error("task error : %s", JSONUtils.toJsonString(taskInstance));
return false;
}
}
/**
* buildTaskPriority
*
* @param processInstancePriority processInstancePriority
* @param processInstanceId processInstanceId
* @param taskInstancePriority taskInstancePriority
* @param taskInstanceId taskInstanceId
* @param workerGroup workerGroup
* @return TaskPriority
*/
private TaskPriority buildTaskPriority(int processInstancePriority,
int processInstanceId,
int taskInstancePriority,
int taskInstanceId,
String workerGroup) {
return new TaskPriority(processInstancePriority, processInstanceId,
taskInstancePriority, taskInstanceId, workerGroup);
}
/**
* submit wait complete
*
* @return true
*/
protected Boolean submitWaitComplete() {
return true; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | }
/**
* call
*
* @return boolean
* @throws Exception exception
*/
@Override
public Boolean call() throws Exception {
this.processInstance = processService.findProcessInstanceById(taskInstance.getProcessInstanceId());
return submitWaitComplete();
}
/**
* alert time out
*/
protected boolean alertTimeout() {
if (TaskTimeoutStrategy.FAILED == this.taskTimeoutParameter.getStrategy()) {
return true;
}
logger.warn("process id:{} process name:{} task id: {},name:{} execution time out",
processInstance.getId(), processInstance.getName(), taskInstance.getId(), taskInstance.getName());
ProcessDefinition processDefine = processService.findProcessDefineById(processInstance.getProcessDefinitionId());
alertDao.sendTaskTimeoutAlert(processInstance.getWarningGroupId(), processInstance.getId(), processInstance.getName(),
taskInstance.getId(), taskInstance.getName());
return true;
}
/**
* handle time out for time out strategy warn&&failed
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterBaseTaskExecThread.java | protected void handleTimeoutFailed() {
if (TaskTimeoutStrategy.WARN == this.taskTimeoutParameter.getStrategy()) {
return;
}
logger.info("process id:{} name:{} task id:{} name:{} cancel because of timeout.",
processInstance.getId(), processInstance.getName(), taskInstance.getId(), taskInstance.getName());
this.cancel = true;
}
/**
* check task remain time valid
*/
protected boolean checkTaskTimeout() {
if (!checkTimeoutFlag || taskInstance.getStartTime() == null) {
return false;
}
long remainTime = getRemainTime(taskTimeoutParameter.getInterval() * 60L);
return remainTime <= 0;
}
/**
* get remain time
*
* @return remain time
*/
protected long getRemainTime(long timeoutSeconds) {
Date startTime = taskInstance.getStartTime();
long usedTime = (System.currentTimeMillis() - startTime.getTime()) / 1000;
return timeoutSeconds - usedTime;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.utils;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.CommonUtils;
import org.apache.dolphinscheduler.common.utils.FileUtils;
import org.apache.dolphinscheduler.common.utils.HadoopUtils;
import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.remote.utils.Host;
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext;
import org.apache.dolphinscheduler.service.log.LogClientService;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* mainly used to get the start command line of a process.
*/
public class ProcessUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | /**
* logger
*/
private static final Logger logger = LoggerFactory.getLogger(ProcessUtils.class);
/**
* Initialization regularization, solve the problem of pre-compilation performance,
* avoid the thread safety problem of multi-thread operation
*/
private static final Pattern MACPATTERN = Pattern.compile("-[+|-]-\\s(\\d+)");
/**
* Expression of PID recognition in Windows scene
*/
private static final Pattern WINDOWSATTERN = Pattern.compile("\\w+\\((\\d+)\\)");
private static final String LOCAL_PROCESS_EXEC = "jdk.lang.Process.allowAmbiguousCommands";
/**
* build command line characters.
*
* @param commandList command list
* @return command
*/
public static String buildCommandStr(List<String> commandList) {
String cmdstr;
String[] cmd = commandList.toArray(new String[0]);
SecurityManager security = System.getSecurityManager();
boolean allowAmbiguousCommands = isAllowAmbiguousCommands(security);
if (allowAmbiguousCommands) {
String executablePath = new File(cmd[0]).getPath();
if (needsEscaping(VERIFICATION_LEGACY, executablePath)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | executablePath = quoteString(executablePath);
}
cmdstr = createCommandLine(
VERIFICATION_LEGACY, executablePath, cmd);
} else {
String executablePath;
try {
executablePath = getExecutablePath(cmd[0]);
} catch (IllegalArgumentException e) {
StringBuilder join = new StringBuilder();
for (String s : cmd) {
join.append(s).append(' ');
}
cmd = getTokensFromCommand(join.toString());
executablePath = getExecutablePath(cmd[0]);
if (security != null) {
security.checkExec(executablePath);
}
}
cmdstr = createCommandLine(
isShellFile(executablePath) ? VERIFICATION_CMD_BAT : VERIFICATION_WIN32, quoteString(executablePath), cmd);
}
return cmdstr;
}
/**
* check is allow ambiguous commands
*
* @param security security manager
* @return allow ambiguous command flag |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | */
private static boolean isAllowAmbiguousCommands(SecurityManager security) {
boolean allowAmbiguousCommands = false;
if (security == null) {
allowAmbiguousCommands = true;
String value = System.getProperty(LOCAL_PROCESS_EXEC);
if (value != null) {
allowAmbiguousCommands = !Constants.STRING_FALSE.equalsIgnoreCase(value);
}
}
return allowAmbiguousCommands;
}
/**
* get executable path.
*
* @param path path
* @return executable path
*/
private static String getExecutablePath(String path) {
boolean pathIsQuoted = isQuoted(true, path, "Executable name has embedded quote, split the arguments");
File fileToRun = new File(pathIsQuoted ? path.substring(1, path.length() - 1) : path);
return fileToRun.getPath();
}
/**
* whether is shell file.
*
* @param executablePath executable path
* @return true if endsWith .CMD or .BAT
*/
private static boolean isShellFile(String executablePath) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | String upPath = executablePath.toUpperCase();
return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT"));
}
/**
* quote string.
*
* @param arg argument
* @return format arg
*/
private static String quoteString(String arg) {
return '"' + arg + '"';
}
/**
* get tokens from command.
*
* @param command command
* @return token string array
*/
private static String[] getTokensFromCommand(String command) {
ArrayList<String> matchList = new ArrayList<>(8);
Matcher regexMatcher = LazyPattern.PATTERN.matcher(command);
while (regexMatcher.find()) {
matchList.add(regexMatcher.group());
}
return matchList.toArray(new String[0]);
}
/**
* Lazy Pattern.
*/
private static class LazyPattern { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | /**
* Escape-support version:
* "(\")((?:\\\\\\1|.)+?)\\1|([^\\s\"]+)";
*/
private static final Pattern PATTERN = Pattern.compile("[^\\s\"]+|\"[^\"]*\"");
}
/**
* verification cmd bat.
*/
private static final int VERIFICATION_CMD_BAT = 0;
/**
* verification win32.
*/
private static final int VERIFICATION_WIN32 = 1;
/**
* verification legacy.
*/
private static final int VERIFICATION_LEGACY = 2;
/**
* escape verification.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | private static final char[][] ESCAPE_VERIFICATION = {{' ', '\t', '<', '>', '&', '|', '^'},
{' ', '\t', '<', '>'}, {' ', '\t'}};
/**
* create command line.
*
* @param verificationType verification type
* @param executablePath executable path
* @param cmd cmd
* @return command line
*/
private static String createCommandLine(int verificationType, final String executablePath, final String[] cmd) {
StringBuilder cmdbuf = new StringBuilder(80);
cmdbuf.append(executablePath);
for (int i = 1; i < cmd.length; ++i) {
cmdbuf.append(' ');
String s = cmd[i];
if (needsEscaping(verificationType, s)) {
cmdbuf.append('"').append(s);
if ((verificationType != VERIFICATION_CMD_BAT) && s.endsWith("\\")) {
cmdbuf.append('\\');
}
cmdbuf.append('"');
} else {
cmdbuf.append(s);
}
}
return cmdbuf.toString();
}
/**
* whether is quoted. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | *
* @param noQuotesInside no quotes inside
* @param arg arg
* @param errorMessage error message
* @return boolean
*/
private static boolean isQuoted(boolean noQuotesInside, String arg, String errorMessage) {
int lastPos = arg.length() - 1;
if (lastPos >= 1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') {
if (noQuotesInside && arg.indexOf('"', 1) != lastPos) {
throw new IllegalArgumentException(errorMessage);
}
return true;
}
if (noQuotesInside && arg.indexOf('"') >= 0) {
throw new IllegalArgumentException(errorMessage);
}
return false;
}
/**
* whether needs escaping.
*
* @param verificationType verification type
* @param arg arg
* @return boolean
*/
private static boolean needsEscaping(int verificationType, String arg) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,147 | [Improvement][Master] this expression which always evaluates "true" | *For better global communication, please give priority to using English description, thx! *
*Please review https://dolphinscheduler.apache.org/en-us/community/development/issue.html when describe an issue.*
**Describe the question**
this expression which always evaluates "true"
**What are the current deficiencies and the benefits of improvement**
this expression which always evaluates "true" ,removeTaskLogFile method of org.apache.dolphinscheduler.service.process
**Which version of DolphinScheduler:**
-[1.3.5]
**Describe alternatives you've considered**
public void removeTaskLogFile(Integer processInstanceId) {
LogClientService logClient = null;
try {
logClient = new LogClientService();
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (StringUtils.isEmpty(taskInstance.getHost())) {
continue;
}
int port = Constants.RPC_PORT;
String ip = "";
try {
ip = Host.of(taskInstance.getHost()).getIp();
} catch (Exception e) {
// compatible old version
ip = taskInstance.getHost();
}
// remove task log from loggerserver
logClient.removeTaskLog(ip, port, taskLogPath);
}
} finally {
logClient.close();
}
}
| https://github.com/apache/dolphinscheduler/issues/5147 | https://github.com/apache/dolphinscheduler/pull/5156 | fe144e46a3f23f5b484a3ce74552cc6faad9009c | 513eb769196971956f15665640aefd782b9f69f3 | "2021-03-25T07:29:28Z" | java | "2021-04-19T09:48:09Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java | boolean argIsQuoted = isQuoted((verificationType == VERIFICATION_CMD_BAT), arg, "Argument has embedded quote, use the explicit CMD.EXE call.");
if (!argIsQuoted) {
char[] testEscape = ESCAPE_VERIFICATION[verificationType];
for (char c : testEscape) {
if (arg.indexOf(c) >= 0) {
return true;
}
}
}
return false;
}
/**
* kill yarn application.
*
* @param appIds app id list
* @param logger logger
* @param tenantCode tenant code
* @param executePath execute path
*/
public static void cancelApplication(List<String> appIds, Logger logger, String tenantCode, String executePath) {
if (CollectionUtils.isNotEmpty(appIds)) {
for (String appId : appIds) {
try {
ExecutionStatus applicationStatus = HadoopUtils.getInstance().getApplicationStatus(appId);
if (!applicationStatus.typeIsFinished()) {
String commandFile = String
.format("%s/%s.kill", executePath, appId);
String cmd = getKerberosInitCommand() + "yarn application -kill " + appId;
execYarnKillCommand(logger, tenantCode, appId, commandFile, cmd);
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.