Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sia-task-build-component/bin/run4config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ echo $(pwd)

# Second, should I watch?
working_directory=$(pwd)
log_dir=$working_directory/../logs
proc_watcher="no"
if [ "$1" == "--no-watch" ]; then
proc_watcher="no"
Expand All @@ -49,7 +50,7 @@ echo "using workspace $working_directory"
echo "proc_watch: $proc_watcher"

javaOpts="-server -Xms128m -Xmx256m -Xss256k -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 -XX:CMSIncrementalDutyCycle=10 -XX:+UseParNewGC -XX:+UseCMSCompactAtFullCollection -XX:-CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=0 -XX:CMSInitiatingOccupancyFraction=70 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=."
java $javaOpts -XX:OnOutOfMemoryError='kill -9 %p' -Dspring.config.location=../config/$task_config -jar $working_directory/$2 &
java $javaOpts -XX:OnOutOfMemoryError='kill -9 %p' -Dspring.config.location=../config/$task_config -Dlog.dir=$log_dir -jar $working_directory/$2 &

# Fourth, add crontab process watcher
if [ "$proc_watcher" == "yes" ]; then
Expand Down
3 changes: 2 additions & 1 deletion sia-task-build-component/bin/run4scheduler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ echo $(pwd)

# Second, should I watch?
working_directory=$(pwd)
log_dir=$working_directory/../logs
proc_watcher="no"
if [ "$1" == "--no-watch" ]; then
proc_watcher="no"
Expand All @@ -49,7 +50,7 @@ echo "using workspace $working_directory"
echo "proc_watch: $proc_watcher"

javaOpts="-server -Xms128m -Xmx256m -Xss256k -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 -XX:CMSIncrementalDutyCycle=10 -XX:+UseParNewGC -XX:+UseCMSCompactAtFullCollection -XX:-CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=0 -XX:CMSInitiatingOccupancyFraction=70 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=."
java $javaOpts -XX:OnOutOfMemoryError='kill -9 %p' -Dspring.config.location=../config/$task_config -jar $working_directory/$2 &
java $javaOpts -XX:OnOutOfMemoryError='kill -9 %p' -Dspring.config.location=../config/$task_config -Dlog.dir=$log_dir -jar $working_directory/$2 &

# Fourth, add crontab process watcher
if [ "$proc_watcher" == "yes" ]; then
Expand Down
12 changes: 12 additions & 0 deletions sia-task-build-component/bin/shutdown_task_config_open.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#!/bin/sh
case "`uname`" in
Linux)
bin_absolute_path=$(readlink -f $(dirname $0))
;;
*)
bin_absolute_path=`cd $(dirname $0);pwd`
;;
esac

export LANG=en_US.UTF-8
base_dir=${bin_absolute_path}/..
cd $base_dir/bin
nohup sh stop.sh task_config_open >$(pwd)/task_config_open.shutdown 2>&1 &
12 changes: 12 additions & 0 deletions sia-task-build-component/bin/shutdown_task_scheduler_open.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#!/bin/sh
case "`uname`" in
Linux)
bin_absolute_path=$(readlink -f $(dirname $0))
;;
*)
bin_absolute_path=`cd $(dirname $0);pwd`
;;
esac

export LANG=en_US.UTF-8
base_dir=${bin_absolute_path}/..
cd $base_dir/bin
nohup sh stop.sh task_scheduler_open >$(pwd)/task_scheduler_open.shutdown 2>&1 &
12 changes: 12 additions & 0 deletions sia-task-build-component/bin/start_task_config_open.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#!/bin/sh
case "`uname`" in
Linux)
bin_absolute_path=$(readlink -f $(dirname $0))
;;
*)
bin_absolute_path=`cd $(dirname $0);pwd`
;;
esac

export LANG=en_US.UTF-8
base_dir=${bin_absolute_path}/..
cd $base_dir/bin
nohup sh run4config.sh task_config_open sia-task-config-1.0.0.jar >$(pwd)/task_config_open.start 2>&1 &
12 changes: 12 additions & 0 deletions sia-task-build-component/bin/start_task_scheduler_open.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#!/bin/sh
case "`uname`" in
Linux)
bin_absolute_path=$(readlink -f $(dirname $0))
;;
*)
bin_absolute_path=`cd $(dirname $0);pwd`
;;
esac

export LANG=en_US.UTF-8
base_dir=${bin_absolute_path}/..
cd $base_dir/bin
nohup sh run4scheduler.sh task_scheduler_open sia-task-scheduler-1.0.0.jar >$(pwd)/task_scheduler_open.start 2>&1 &
2 changes: 1 addition & 1 deletion sia-task-build-component/config/task_config_open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pagehelper:
#############################################################
############## log config ###################################
#############################################################
logging.file: ./logs/${spring.application.name}.log
logging.file: ${log.dir}/${spring.application.name}.log

# task根路径
# 可选参数,需要overwritten此参数时,打开注释并填写指定的ZK根路径,否则默认为SkyWorldOnlineTask
Expand Down
2 changes: 1 addition & 1 deletion sia-task-build-component/config/task_scheduler_open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ onlinetask.job.fault.tolerant: 1
#############################################################
############## log config ###################################
#############################################################
logging.file: ./logs/${spring.application.name}.log
logging.file: ${log.dir}/${spring.application.name}.log

# task根路径
# 可选参数,需要overwritten此参数时,打开注释并填写指定的ZK根路径,否则默认为SkyWorldOnlineTask
Expand Down
10 changes: 2 additions & 8 deletions sia-task-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,10 @@
<excludes>
<exclude>application.yml</exclude>
<exclude>application-open.yml</exclude>
<exclude>logback.xml</exclude>
<exclude>logback-example.xml</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application.yml</include>
<include>application-open.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Collections;
import java.util.List;

/**
Expand All @@ -50,6 +51,9 @@ public List<String> getCurrentUserRoles(){
List<String> roleNames;
HttpSession session = request.getSession();
roleNames = (List<String>) session.getAttribute("roleNames");
if (roleNames == null) {
roleNames = Collections.emptyList();
}
if (roleNames.contains(Constants.ADMIN_ROLE)) {
roleNames = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@
import com.sia.core.helper.StringHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
*
Expand All @@ -55,23 +52,17 @@ public void init(FilterConfig filterConfig) throws ServletException {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
httpServletResponse.setHeader("Access-Control-Allow-Origin", httpServletRequest.getHeader("Origin"));
httpServletResponse.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE,PUT");
String origin = httpServletRequest.getHeader("Origin");
if(origin == null) {
origin = httpServletRequest.getHeader("Referer");
}
httpServletResponse.setHeader("Access-Control-Allow-Origin", origin);
httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, DELETE, OPTIONS, PATCH");
httpServletResponse.setHeader("Access-Control-Max-Age", "3600");
httpServletResponse.setHeader("Access-Control-Allow-Headers", "Authentication,Origin,X-Requested-With,Content-Type,Accept");
httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true");
httpServletResponse.setHeader("XDomainRequestAllowed","1");

String method = httpServletRequest.getMethod();

if (METHOD_OPTIONS.equals(method)){
filterChain.doFilter(httpServletRequest, servletResponse);
} if (httpServletRequest.getRequestURI().contains("login")){
filterChain.doFilter(httpServletRequest, httpServletResponse);
}
else{
filterChain.doFilter(httpServletRequest, httpServletResponse);
}
filterChain.doFilter(httpServletRequest, httpServletResponse);
}


Expand Down
12 changes: 2 additions & 10 deletions sia-task-scheduler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,11 @@
<excludes>
<exclude>application.yml</exclude>
<exclude>application-open.yml</exclude>

<exclude>logback.xml</exclude>
<exclude>logback-example.xml</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application.yml</include>
<include>application-open.yml</include>
</includes>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

package com.sia.scheduler.quartz.impl;

import com.sia.core.entity.BasicJob;
import com.sia.core.entity.JobMTask;
import com.sia.scheduler.context.SpringContext;
import com.sia.scheduler.http.route.ExecutorRouteSharding;
import com.sia.scheduler.service.JobLogService;
import com.sia.scheduler.service.common.CommonService;
import com.sia.scheduler.thread.execute.TaskCommit;
Expand Down Expand Up @@ -70,7 +70,10 @@ public void execute(JobExecutionContext context) throws JobExecutionException {

String jobGroup = context.getTrigger().getJobKey().getGroup();
String jobKey = context.getTrigger().getJobKey().getName();
SpringContext.getRunningJob().get(jobKey).setTriggerInstance(Constants.LOCALHOST);
BasicJob job = SpringContext.getRunningJob().get(jobKey);
if (job != null) {
job.setTriggerInstance(Constants.LOCALHOST);
}

List<JobMTask> onlineTaskList = analyticalJob(jobGroup, jobKey);

Expand Down