fix: official processor can't work

This commit is contained in:
tjq 2021-03-06 00:11:52 +08:00
parent 27ebd42c8e
commit a0564b7922
4 changed files with 16 additions and 8 deletions

View File

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>powerjob-official-processors</artifactId>
<version>1.0.1</version>
<version>1.0.3</version>
<packaging>jar</packaging>
<properties>
@ -23,6 +23,7 @@
<powerjob.worker.version>3.4.7</powerjob.worker.version>
<!-- 全部 shade 化,避免依赖冲突 -->
<slf4j.version>1.7.30</slf4j.version>
<fastjson.version>1.2.68</fastjson.version>
<okhttp.version>3.14.9</okhttp.version>
<guava.version>29.0-jre</guava.version>
@ -31,6 +32,13 @@
<dependencies>
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- fastJson(used for serialization of DAG) -->
<dependency>
<groupId>com.alibaba</groupId>

View File

@ -19,16 +19,16 @@ import tech.powerjob.official.processors.util.CommonUtils;
public abstract class CommonBasicProcessor implements BasicProcessor {
@Override
public ProcessResult process(TaskContext taskContext) throws Exception {
public ProcessResult process(TaskContext ctx) throws Exception {
String status = "unknown";
Stopwatch sw = Stopwatch.createStarted();
OmsLogger omsLogger = taskContext.getOmsLogger();
omsLogger.info("using params: {}", CommonUtils.parseParams(taskContext));
OmsLogger omsLogger = ctx.getOmsLogger();
omsLogger.info("using params: {}", CommonUtils.parseParams(ctx));
try {
ProcessResult result = process0(taskContext);
ProcessResult result = process0(ctx);
omsLogger.info("execute succeed, using {}, result: {}", sw, result);
status = result.isSuccess() ? "succeed" : "failed";
return result;
@ -37,7 +37,7 @@ public abstract class CommonBasicProcessor implements BasicProcessor {
omsLogger.error("execute failed!", t);
return new ProcessResult(false, ExceptionUtils.getMessage(t));
} finally {
log.info("status: {}, cost: {}", status, sw);
log.info("{}|{}|{}|{}|{}", getClass().getSimpleName(), ctx.getJobId(), ctx.getInstanceId(), status, sw);
}
}

View File

@ -3,7 +3,7 @@ logging.config=classpath:logback-dev.xml
####### Database properties(Configure according to the the environment) #######
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3307/powerjob-daily?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/powerjob-daily?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
spring.datasource.core.username=root
spring.datasource.core.password=No1Bug2Please3!
spring.datasource.core.hikari.maximum-pool-size=20

View File

@ -21,7 +21,7 @@
<spring.boot.version>2.2.6.RELEASE</spring.boot.version>
<powerjob.official.processors.version>1.0.1</powerjob.official.processors.version>
<powerjob.official.processors.version>1.0.3</powerjob.official.processors.version>
</properties>
<dependencies>