Browse Source

[Bug-9137][Server] fix timezone init (#9219)

Co-authored-by: caishunfeng <534328519@qq.com>
3.0.0/version-upgrade
caishunfeng 3 years ago committed by GitHub
parent
commit
263791a63e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/bin/start.sh
  2. 13
      dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java
  3. 2
      dolphinscheduler-api/src/main/bin/start.sh
  4. 12
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java
  5. 4
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java
  6. 2
      dolphinscheduler-master/src/main/bin/start.sh
  7. 8
      dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java
  8. 2
      dolphinscheduler-python/src/main/bin/start.sh
  9. 123
      dolphinscheduler-python/src/main/java/org/apache/dolphinscheduler/server/PythonGatewayServer.java
  10. 4
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java
  11. 2
      dolphinscheduler-standalone-server/src/main/bin/start.sh
  12. 2
      dolphinscheduler-standalone-server/src/main/dist-bin/start.sh
  13. 13
      dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/StandaloneServer.java
  14. 2
      dolphinscheduler-worker/src/main/bin/start.sh
  15. 7
      dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

2
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/bin/start.sh

@ -21,7 +21,7 @@ DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)}
source "$BIN_DIR/dolphinscheduler_env.sh" source "$BIN_DIR/dolphinscheduler_env.sh"
JAVA_OPTS=${JAVA_OPTS:-"-server -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"} JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
if [[ "$DOCKER" == "true" ]]; then if [[ "$DOCKER" == "true" ]]; then
JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport" JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport"

13
dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertServer.java

@ -27,17 +27,14 @@ import org.apache.dolphinscheduler.remote.config.NettyServerConfig;
import java.io.Closeable; import java.io.Closeable;
import java.util.List; import java.util.List;
import java.util.TimeZone;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.event.ApplicationReadyEvent;
@ -60,9 +57,6 @@ public class AlertServer implements Closeable {
@Autowired @Autowired
private AlertConfig config; private AlertConfig config;
@Value("${spring.jackson.time-zone:UTC}")
private String timezone;
public AlertServer(PluginDao pluginDao, AlertDao alertDao, AlertPluginManager alertPluginManager, AlertSender alertSender, AlertRequestProcessor alertRequestProcessor) { public AlertServer(PluginDao pluginDao, AlertDao alertDao, AlertPluginManager alertPluginManager, AlertSender alertSender, AlertRequestProcessor alertRequestProcessor) {
this.pluginDao = pluginDao; this.pluginDao = pluginDao;
this.alertDao = alertDao; this.alertDao = alertDao;
@ -75,11 +69,6 @@ public class AlertServer implements Closeable {
SpringApplication.run(AlertServer.class, args); SpringApplication.run(AlertServer.class, args);
} }
@PostConstruct
public void init() {
TimeZone.setDefault(TimeZone.getTimeZone(timezone));
}
@EventListener @EventListener
public void start(ApplicationReadyEvent readyEvent) { public void start(ApplicationReadyEvent readyEvent) {
logger.info("Starting Alert server"); logger.info("Starting Alert server");
@ -88,7 +77,7 @@ public class AlertServer implements Closeable {
startServer(); startServer();
Executors.newScheduledThreadPool(1) Executors.newScheduledThreadPool(1)
.scheduleAtFixedRate(new Sender(), 5, 5, TimeUnit.SECONDS); .scheduleAtFixedRate(new Sender(), 5, 5, TimeUnit.SECONDS);
} }
@Override @Override

2
dolphinscheduler-api/src/main/bin/start.sh

@ -21,7 +21,7 @@ DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)}
source "$BIN_DIR/dolphinscheduler_env.sh" source "$BIN_DIR/dolphinscheduler_env.sh"
JAVA_OPTS=${JAVA_OPTS:-"-server -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"} JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
if [[ "$DOCKER" == "true" ]]; then if [[ "$DOCKER" == "true" ]]; then
JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport" JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport"

12
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java

@ -17,11 +17,6 @@
package org.apache.dolphinscheduler.api; package org.apache.dolphinscheduler.api;
import java.util.TimeZone;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
@ -32,15 +27,8 @@ import org.springframework.context.annotation.ComponentScan;
@ComponentScan("org.apache.dolphinscheduler") @ComponentScan("org.apache.dolphinscheduler")
public class ApiApplicationServer { public class ApiApplicationServer {
@Value("${spring.jackson.time-zone:UTC}")
private String timezone;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(ApiApplicationServer.class); SpringApplication.run(ApiApplicationServer.class);
} }
@PostConstruct
public void run() {
TimeZone.setDefault(TimeZone.getTimeZone(timezone));
}
} }

4
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/JSONUtils.java

@ -63,6 +63,10 @@ public class JSONUtils {
private static final Logger logger = LoggerFactory.getLogger(JSONUtils.class); private static final Logger logger = LoggerFactory.getLogger(JSONUtils.class);
static {
logger.info("init timezone: {}",TimeZone.getDefault());
}
/** /**
* can use static singleton, inject: just make sure to reuse! * can use static singleton, inject: just make sure to reuse!
*/ */

2
dolphinscheduler-master/src/main/bin/start.sh

@ -21,7 +21,7 @@ DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)}
source "$BIN_DIR/dolphinscheduler_env.sh" source "$BIN_DIR/dolphinscheduler_env.sh"
JAVA_OPTS=${JAVA_OPTS:-"-server -Xms4g -Xmx4g -Xmn2g -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"} JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms4g -Xmx4g -Xmn2g -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
if [[ "$DOCKER" == "true" ]]; then if [[ "$DOCKER" == "true" ]]; then
JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport" JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport"

8
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java

@ -37,8 +37,6 @@ import org.apache.dolphinscheduler.server.master.runner.FailoverExecuteThread;
import org.apache.dolphinscheduler.server.master.runner.MasterSchedulerService; import org.apache.dolphinscheduler.server.master.runner.MasterSchedulerService;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import java.util.TimeZone;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.quartz.Scheduler; import org.quartz.Scheduler;
@ -46,7 +44,6 @@ import org.quartz.SchedulerException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
@ -104,9 +101,6 @@ public class MasterServer implements IStoppable {
@Autowired @Autowired
private LoggerRequestProcessor loggerRequestProcessor; private LoggerRequestProcessor loggerRequestProcessor;
@Value("${spring.jackson.time-zone:UTC}")
private String timezone;
public static void main(String[] args) { public static void main(String[] args) {
Thread.currentThread().setName(Constants.THREAD_NAME_MASTER_SERVER); Thread.currentThread().setName(Constants.THREAD_NAME_MASTER_SERVER);
SpringApplication.run(MasterServer.class); SpringApplication.run(MasterServer.class);
@ -117,8 +111,6 @@ public class MasterServer implements IStoppable {
*/ */
@PostConstruct @PostConstruct
public void run() throws SchedulerException { public void run() throws SchedulerException {
TimeZone.setDefault(TimeZone.getTimeZone(timezone));
// init remoting server // init remoting server
NettyServerConfig serverConfig = new NettyServerConfig(); NettyServerConfig serverConfig = new NettyServerConfig();
serverConfig.setListenPort(masterConfig.getListenPort()); serverConfig.setListenPort(masterConfig.getListenPort());

2
dolphinscheduler-python/src/main/bin/start.sh

@ -21,7 +21,7 @@ DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)}
source "$BIN_DIR/dolphinscheduler_env.sh" source "$BIN_DIR/dolphinscheduler_env.sh"
JAVA_OPTS=${JAVA_OPTS:-"-server -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"} JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
if [[ "$DOCKER" == "true" ]]; then if [[ "$DOCKER" == "true" ]]; then
JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport" JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport"

123
dolphinscheduler-python/src/main/java/org/apache/dolphinscheduler/server/PythonGatewayServer.java

@ -59,6 +59,8 @@ import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.server.config.PythonGatewayConfig; import org.apache.dolphinscheduler.server.config.PythonGatewayConfig;
import org.apache.dolphinscheduler.spi.enums.ResourceType; import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.commons.collections.CollectionUtils;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Date; import java.util.Date;
@ -66,7 +68,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.TimeZone;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@ -74,7 +75,6 @@ import javax.annotation.PostConstruct;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@ -82,8 +82,6 @@ import org.springframework.context.annotation.ComponentScan;
import py4j.GatewayServer; import py4j.GatewayServer;
import org.apache.commons.collections.CollectionUtils;
@SpringBootApplication @SpringBootApplication
@ComponentScan(value = "org.apache.dolphinscheduler") @ComponentScan(value = "org.apache.dolphinscheduler")
public class PythonGatewayServer extends SpringBootServletInitializer { public class PythonGatewayServer extends SpringBootServletInitializer {
@ -148,14 +146,6 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
@Autowired @Autowired
private ProjectUserMapper projectUserMapper; private ProjectUserMapper projectUserMapper;
@Value("${spring.jackson.time-zone:UTC}")
private String timezone;
@PostConstruct
public void init() {
TimeZone.setDefault(TimeZone.getTimeZone(timezone));
}
// TODO replace this user to build in admin user if we make sure build in one could not be change // TODO replace this user to build in admin user if we make sure build in one could not be change
private final User dummyAdminUser = new User() { private final User dummyAdminUser = new User() {
{ {
@ -207,19 +197,19 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
* If process definition do not exists in Project=`projectCode` would create a new one * If process definition do not exists in Project=`projectCode` would create a new one
* If process definition already exists in Project=`projectCode` would update it * If process definition already exists in Project=`projectCode` would update it
* *
* @param userName user name who create or update process definition * @param userName user name who create or update process definition
* @param projectName project name which process definition belongs to * @param projectName project name which process definition belongs to
* @param name process definition name * @param name process definition name
* @param description description * @param description description
* @param globalParams global params * @param globalParams global params
* @param schedule schedule for process definition, will not set schedule if null, * @param schedule schedule for process definition, will not set schedule if null,
* and if would always fresh exists schedule if not null * and if would always fresh exists schedule if not null
* @param locations locations json object about all tasks * @param locations locations json object about all tasks
* @param timeout timeout for process definition working, if running time longer than timeout, * @param timeout timeout for process definition working, if running time longer than timeout,
* task will mark as fail * task will mark as fail
* @param workerGroup run task in which worker group * @param workerGroup run task in which worker group
* @param tenantCode tenantCode * @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes * @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson * @param taskDefinitionJson taskDefinitionJson
* @return create result code * @return create result code
*/ */
@ -248,10 +238,10 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
// make sure process definition offline which could edit // make sure process definition offline which could edit
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE); processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE);
Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams, Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, executionType); locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, executionType);
} else { } else {
Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams, Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, executionType); locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, executionType);
processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST); processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST);
processDefinitionCode = processDefinition.getCode(); processDefinitionCode = processDefinition.getCode();
} }
@ -266,8 +256,9 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
/** /**
* get process definition * get process definition
* @param user user who create or update schedule *
* @param projectCode project which process definition belongs to * @param user user who create or update schedule
* @param projectCode project which process definition belongs to
* @param processDefinitionName process definition name * @param processDefinitionName process definition name
*/ */
private ProcessDefinition getProcessDefinition(User user, long projectCode, String processDefinitionName) { private ProcessDefinition getProcessDefinition(User user, long projectCode, String processDefinitionName) {
@ -291,11 +282,11 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
* It would always use latest schedule define in workflow-as-code, and set schedule online when * It would always use latest schedule define in workflow-as-code, and set schedule online when
* it's not null * it's not null
* *
* @param user user who create or update schedule * @param user user who create or update schedule
* @param projectCode project which process definition belongs to * @param projectCode project which process definition belongs to
* @param processDefinitionCode process definition code * @param processDefinitionCode process definition code
* @param schedule schedule expression * @param schedule schedule expression
* @param workerGroup work group * @param workerGroup work group
*/ */
private void createOrUpdateSchedule(User user, private void createOrUpdateSchedule(User user,
long projectCode, long projectCode,
@ -308,13 +299,13 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
if (scheduleObj == null) { if (scheduleObj == null) {
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.ONLINE); processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.ONLINE);
Map<String, Object> result = schedulerService.insertSchedule(user, projectCode, processDefinitionCode, schedule, DEFAULT_WARNING_TYPE, Map<String, Object> result = schedulerService.insertSchedule(user, projectCode, processDefinitionCode, schedule, DEFAULT_WARNING_TYPE,
DEFAULT_WARNING_GROUP_ID, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE); DEFAULT_WARNING_GROUP_ID, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE);
scheduleId = (int) result.get("scheduleId"); scheduleId = (int) result.get("scheduleId");
} else { } else {
scheduleId = scheduleObj.getId(); scheduleId = scheduleObj.getId();
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE); processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE);
schedulerService.updateSchedule(user, projectCode, scheduleId, schedule, DEFAULT_WARNING_TYPE, schedulerService.updateSchedule(user, projectCode, scheduleId, schedule, DEFAULT_WARNING_TYPE,
DEFAULT_WARNING_GROUP_ID, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE); DEFAULT_WARNING_GROUP_ID, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE);
} }
schedulerService.setScheduleState(user, projectCode, scheduleId, ReleaseState.ONLINE); schedulerService.setScheduleState(user, projectCode, scheduleId, ReleaseState.ONLINE);
} }
@ -334,24 +325,24 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
processDefinitionService.releaseProcessDefinition(user, project.getCode(), processDefinition.getCode(), ReleaseState.ONLINE); processDefinitionService.releaseProcessDefinition(user, project.getCode(), processDefinition.getCode(), ReleaseState.ONLINE);
executorService.execProcessInstance(user, executorService.execProcessInstance(user,
project.getCode(), project.getCode(),
processDefinition.getCode(), processDefinition.getCode(),
cronTime, cronTime,
null, null,
DEFAULT_FAILURE_STRATEGY, DEFAULT_FAILURE_STRATEGY,
null, null,
DEFAULT_TASK_DEPEND_TYPE, DEFAULT_TASK_DEPEND_TYPE,
DEFAULT_WARNING_TYPE, DEFAULT_WARNING_TYPE,
DEFAULT_WARNING_GROUP_ID, DEFAULT_WARNING_GROUP_ID,
DEFAULT_RUN_MODE, DEFAULT_RUN_MODE,
DEFAULT_PRIORITY, DEFAULT_PRIORITY,
workerGroup, workerGroup,
DEFAULT_ENVIRONMENT_CODE, DEFAULT_ENVIRONMENT_CODE,
timeout, timeout,
null, null,
null, null,
DEFAULT_DRY_RUN, DEFAULT_DRY_RUN,
COMPLEMENT_DEPENDENT_MODE COMPLEMENT_DEPENDENT_MODE
); );
} }
@ -468,8 +459,8 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
* Get processDefinition by given processDefinitionName name. It return map contain processDefinition id, name, code. * Get processDefinition by given processDefinitionName name. It return map contain processDefinition id, name, code.
* Useful in Python API create subProcess task which need processDefinition information. * Useful in Python API create subProcess task which need processDefinition information.
* *
* @param userName user who create or update schedule * @param userName user who create or update schedule
* @param projectName project name which process definition belongs to * @param projectName project name which process definition belongs to
* @param processDefinitionName process definition name * @param processDefinitionName process definition name
*/ */
public Map<String, Object> getProcessDefinitionInfo(String userName, String projectName, String processDefinitionName) { public Map<String, Object> getProcessDefinitionInfo(String userName, String projectName, String processDefinitionName) {
@ -499,9 +490,9 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
* Get project, process definition, task code. * Get project, process definition, task code.
* Useful in Python API create dependent task which need processDefinition information. * Useful in Python API create dependent task which need processDefinition information.
* *
* @param projectName project name which process definition belongs to * @param projectName project name which process definition belongs to
* @param processDefinitionName process definition name * @param processDefinitionName process definition name
* @param taskName task name * @param taskName task name
*/ */
public Map<String, Object> getDependentInfo(String projectName, String processDefinitionName, String taskName) { public Map<String, Object> getDependentInfo(String projectName, String processDefinitionName, String taskName) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
@ -535,7 +526,7 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
* Useful in Python API create flink or spark task which need processDefinition information. * Useful in Python API create flink or spark task which need processDefinition information.
* *
* @param programType program type one of SCALA, JAVA and PYTHON * @param programType program type one of SCALA, JAVA and PYTHON
* @param fullName full name of the resource * @param fullName full name of the resource
*/ */
public Map<String, Object> getResourcesFileInfo(String programType, String fullName) { public Map<String, Object> getResourcesFileInfo(String programType, String fullName) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
@ -561,14 +552,14 @@ public class PythonGatewayServer extends SpringBootServletInitializer {
InetAddress gatewayHost = InetAddress.getByName(pythonGatewayConfig.getGatewayServerAddress()); InetAddress gatewayHost = InetAddress.getByName(pythonGatewayConfig.getGatewayServerAddress());
InetAddress pythonHost = InetAddress.getByName(pythonGatewayConfig.getPythonAddress()); InetAddress pythonHost = InetAddress.getByName(pythonGatewayConfig.getPythonAddress());
server = new GatewayServer( server = new GatewayServer(
this, this,
pythonGatewayConfig.getGatewayServerPort(), pythonGatewayConfig.getGatewayServerPort(),
pythonGatewayConfig.getPythonPort(), pythonGatewayConfig.getPythonPort(),
gatewayHost, gatewayHost,
pythonHost, pythonHost,
pythonGatewayConfig.getConnectTimeout(), pythonGatewayConfig.getConnectTimeout(),
pythonGatewayConfig.getReadTimeout(), pythonGatewayConfig.getReadTimeout(),
null null
); );
GatewayServer.turnLoggingOn(); GatewayServer.turnLoggingOn();
logger.info("PythonGatewayServer started on: " + gatewayHost.toString()); logger.info("PythonGatewayServer started on: " + gatewayHost.toString());

4
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/JSONUtils.java

@ -55,6 +55,10 @@ public class JSONUtils {
private static final Logger logger = LoggerFactory.getLogger(JSONUtils.class); private static final Logger logger = LoggerFactory.getLogger(JSONUtils.class);
static {
logger.info("init timezone: {}",TimeZone.getDefault());
}
/** /**
* can use static singleton, inject: just make sure to reuse! * can use static singleton, inject: just make sure to reuse!
*/ */

2
dolphinscheduler-standalone-server/src/main/bin/start.sh

@ -21,7 +21,7 @@ DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)}
source "$BIN_DIR/dolphinscheduler_env.sh" source "$BIN_DIR/dolphinscheduler_env.sh"
JAVA_OPTS=${JAVA_OPTS:-"-server -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"} JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
if [[ "$DOCKER" == "true" ]]; then if [[ "$DOCKER" == "true" ]]; then
JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport" JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport"

2
dolphinscheduler-standalone-server/src/main/dist-bin/start.sh

@ -21,7 +21,7 @@ DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)}
source "$BIN_DIR/dolphinscheduler_env.sh" source "$BIN_DIR/dolphinscheduler_env.sh"
JAVA_OPTS=${JAVA_OPTS:-"-server -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"} JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
if [[ "$DOCKER" == "true" ]]; then if [[ "$DOCKER" == "true" ]]; then
JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport" JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport"

13
dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/StandaloneServer.java

@ -19,28 +19,15 @@ package org.apache.dolphinscheduler;
import org.apache.curator.test.TestingServer; import org.apache.curator.test.TestingServer;
import java.util.TimeZone;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class StandaloneServer { public class StandaloneServer {
@Value("${spring.jackson.time-zone:UTC}")
private String timezone;
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
final TestingServer server = new TestingServer(true); final TestingServer server = new TestingServer(true);
System.setProperty("registry.zookeeper.connect-string", server.getConnectString()); System.setProperty("registry.zookeeper.connect-string", server.getConnectString());
SpringApplication.run(StandaloneServer.class, args); SpringApplication.run(StandaloneServer.class, args);
} }
@PostConstruct
public void run() {
TimeZone.setDefault(TimeZone.getTimeZone(timezone));
}
} }

2
dolphinscheduler-worker/src/main/bin/start.sh

@ -22,7 +22,7 @@ DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)}
chmod -R 700 ${DOLPHINSCHEDULER_HOME}/config chmod -R 700 ${DOLPHINSCHEDULER_HOME}/config
export DOLPHINSCHEDULER_WORK_HOME=${DOLPHINSCHEDULER_HOME} export DOLPHINSCHEDULER_WORK_HOME=${DOLPHINSCHEDULER_HOME}
JAVA_OPTS=${JAVA_OPTS:-"-server -Xms4g -Xmx4g -Xmn2g -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"} JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms4g -Xmx4g -Xmn2g -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
if [[ "$DOCKER" == "true" ]]; then if [[ "$DOCKER" == "true" ]]; then
JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport" JAVA_OPTS="${JAVA_OPTS} -XX:-UseContainerSupport"

7
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

@ -44,14 +44,12 @@ import org.apache.commons.collections4.CollectionUtils;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
import java.util.TimeZone;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
@ -124,9 +122,6 @@ public class WorkerServer implements IStoppable {
@Autowired @Autowired
private LoggerRequestProcessor loggerRequestProcessor; private LoggerRequestProcessor loggerRequestProcessor;
@Value("${spring.jackson.time-zone:UTC}")
private String timezone;
/** /**
* worker server startup, not use web service * worker server startup, not use web service
* *
@ -142,8 +137,6 @@ public class WorkerServer implements IStoppable {
*/ */
@PostConstruct @PostConstruct
public void run() { public void run() {
TimeZone.setDefault(TimeZone.getTimeZone(timezone));
// init remoting server // init remoting server
NettyServerConfig serverConfig = new NettyServerConfig(); NettyServerConfig serverConfig = new NettyServerConfig();
serverConfig.setListenPort(workerConfig.getListenPort()); serverConfig.setListenPort(workerConfig.getListenPort());

Loading…
Cancel
Save