From 5feaf6106e8c0285e5b4fe59b4114330bf2cfef8 Mon Sep 17 00:00:00 2001 From: tjq Date: Sun, 10 Jan 2021 11:54:16 +0800 Subject: [PATCH] docs: review translation --- .../powerjob/common/ProcessorType.java | 6 ++-- .../powerjob/common/TimeExpressionType.java | 4 ++- .../common/model/DeployedContainerInfo.java | 4 +-- .../powerjob/common/model/InstanceDetail.java | 5 +--- .../powerjob/common/model/SystemMetrics.java | 29 +++++++++---------- .../request/http/SaveJobInfoRequest.java | 8 ++--- .../powerjob/server/OhMyApplication.java | 5 ++-- .../resources/application-daily.properties | 8 +++-- .../main/resources/application-pre.properties | 8 +++-- .../resources/application-product.properties | 8 +++-- powerjob-worker-agent/pom.xml | 1 + .../powerjob/worker/MainApplication.java | 4 +-- 12 files changed, 44 insertions(+), 46 deletions(-) diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ProcessorType.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ProcessorType.java index bb6d7ed9..63a0455a 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ProcessorType.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ProcessorType.java @@ -4,7 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * 处理器类型 + * Task Processor Type * * @author tjq * @since 2020/3/23 @@ -18,8 +18,8 @@ public enum ProcessorType { PYTHON(3, "Python脚本"), JAVA_CONTAINER(4, "Java容器"); - private int v; - private String des; + private final int v; + private final String des; public static ProcessorType of(int v) { for (ProcessorType type : values()) { diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/TimeExpressionType.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/TimeExpressionType.java index 0a8b7634..0d1f2378 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/TimeExpressionType.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/TimeExpressionType.java @@ -7,7 +7,7 @@ import lombok.Getter; import java.util.List; /** - * 时间表达式类型 + * Scheduling time strategies * * @author tjq * @since 2020/3/30 @@ -18,7 +18,9 @@ public enum TimeExpressionType { API(1), CRON(2), + // FIXED_RATE FIX_RATE(3), + // FIXED_DELAY FIX_DELAY(4), WORKFLOW(5); diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/DeployedContainerInfo.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/DeployedContainerInfo.java index 67e8deda..01cae3b4 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/DeployedContainerInfo.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/DeployedContainerInfo.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.NoArgsConstructor; /** - * The class for deployed container. + * Deployed Container Information * * @author tjq * @since 2020/5/18 @@ -29,7 +29,7 @@ public class DeployedContainerInfo implements OmsSerializable { */ private long deployedTime; /** - * Address of the server. Report is not required. + * No need to report to the server */ private String workerAddress; } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceDetail.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceDetail.java index b14ab3dc..55fd57df 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceDetail.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceDetail.java @@ -7,7 +7,7 @@ import lombok.NoArgsConstructor; import java.util.List; /** - * Detailed info of task instances. + * Detailed info of job instances. * * @author tjq * @since 2020/4/11 @@ -32,17 +32,14 @@ public class InstanceDetail implements OmsSerializable { * Status of the task instance. */ private Integer status; - // 任务执行结果(可能不存在) /** * Execution result, which may be null. */ private String result; - // TaskTracker地址 /** * Task tracker address. */ private String taskTrackerAddress; - // 启动参数 /** * Param string that is passed to an instance when it is initialized. */ diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java index c90534f4..6a065789 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java @@ -71,20 +71,17 @@ public class SystemMetrics implements OmsSerializable, Comparable * @return score */ public int calculateScore() { - - if (score > 0) { - return score; - } - - // Memory is vital to TaskTracker, so we set the multiplier factor as 2. - double memScore = (jvmMaxMemory - jvmUsedMemory) * 2; - // Calculate the remaining load of CPU. Multiplier is set as 1. - double cpuScore = cpuProcessors - cpuLoad; - // Windows can not fetch CPU load, set cpuScore as 1. - if (cpuScore > cpuProcessors) { - cpuScore = 1; + if (score > 0) { + return score; + } + // Memory is vital to TaskTracker, so we set the multiplier factor as 2. + double memScore = (jvmMaxMemory - jvmUsedMemory) * 2; + // Calculate the remaining load of CPU. Multiplier is set as 1. + double cpuScore = cpuProcessors - cpuLoad; + // Windows can not fetch CPU load, set cpuScore as 1. + if (cpuScore > cpuProcessors) { + cpuScore = 1; } - score = (int) (memScore + cpuScore); return score; } @@ -93,8 +90,8 @@ public class SystemMetrics implements OmsSerializable, Comparable * Judge if the machine is available. * * @param minCPUCores Minimum available CPU cores. - * @param minMemorySpace 判断标准之最低可用内存 - * @param minDiskSpace Minimum disk space 判断标准之最低可用磁盘空间 + * @param minMemorySpace Minimum available memory size + * @param minDiskSpace Minimum disk space * @return {@code boolean} whether the machine is available. */ public boolean available(double minCPUCores, double minMemorySpace, double minDiskSpace) { @@ -106,8 +103,8 @@ public class SystemMetrics implements OmsSerializable, Comparable return false; } - // Negative number means being unable to fetch CPU info, return true. // 0 indicates the CPU is free, which is the optimal condition. + // Negative number means being unable to fetch CPU info, return true. if (cpuLoad <= 0 || minCPUCores <= 0) { return true; } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/http/SaveJobInfoRequest.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/http/SaveJobInfoRequest.java index 2bc8435f..2f2e25a0 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/http/SaveJobInfoRequest.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/http/SaveJobInfoRequest.java @@ -18,7 +18,7 @@ import java.util.List; public class SaveJobInfoRequest { /** - * id of the job. set null to save or non-null to update the job. + * id of the job. set null to create or non-null to update the job. */ private Long id; /* ************************** Base info of related job. ************************** */ @@ -105,11 +105,6 @@ public class SaveJobInfoRequest { */ private double minDiskSpace = 0; - /** - * {@code 1} indicates that the worker node is running well, - * {@code 2} indicates that the worker node has been inactive - * and future tasks will not be assigned to the node. - */ private boolean enable = true; @@ -117,6 +112,7 @@ public class SaveJobInfoRequest { /** * Designated PowerJob-worker nodes. Blank value indicates that there is * no limit. Non-blank value means to run the corresponding machine(s) only. + * example: 192.168.1.1:27777,192.168.1.2:27777 */ private String designatedWorkers; /** diff --git a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/OhMyApplication.java b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/OhMyApplication.java index bbcc5c64..b73bf65a 100644 --- a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/OhMyApplication.java +++ b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/OhMyApplication.java @@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.scheduling.annotation.EnableScheduling; /** - * SpringBoot entry. + * powerjob-server entry * * @author tjq * @since 2020/3/29 @@ -26,10 +26,9 @@ public class OhMyApplication { public static void main(String[] args) { - // Print tips before starting. pre(); - // Init ActorSystem + // Init ActorSystem first OhMyServer.init(); // Start SpringBoot application. diff --git a/powerjob-server/src/main/resources/application-daily.properties b/powerjob-server/src/main/resources/application-daily.properties index a0b1c299..bb286003 100644 --- a/powerjob-server/src/main/resources/application-daily.properties +++ b/powerjob-server/src/main/resources/application-daily.properties @@ -14,7 +14,8 @@ spring.datasource.core.hikari.minimum-idle=5 oms.mongodb.enable=true spring.data.mongodb.uri=mongodb+srv://zqq:No1Bug2Please3!@cluster0.wie54.gcp.mongodb.net/powerjob_daily?retryWrites=true&w=majority -####### Email properties(Comment out the mail properties if you do not have needs) ####### +####### Email properties(Non-core configuration properties) ####### +####### Delete the following code to disable the mail ####### spring.mail.host=smtp.163.com spring.mail.username=zqq@163.com spring.mail.password=GOFZPNARMVKCGONV @@ -22,7 +23,8 @@ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true -####### DingTalk properties(Comment out the DingTalk properties if you do not have needs) ####### +####### DingTalk properties(Non-core configuration properties) ####### +####### Delete the following code to disable the DingTalk ####### oms.alarm.ding.app-key=dingauqwkvxxnqskknfv oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl oms.alarm.ding.agent-id=847044348 @@ -35,6 +37,6 @@ oms.container.retention.remote=-1 ####### Cache properties ####### oms.instance.metadata.cache.size=1024 -####### Threshold in fetching server(0~100). 100 means full detection of server, in which ####### +####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which ####### ####### split-brain could be avoided while performance overhead would increase. ####### oms.accurate.select.server.percentage = 50 \ No newline at end of file diff --git a/powerjob-server/src/main/resources/application-pre.properties b/powerjob-server/src/main/resources/application-pre.properties index f0f27100..c3ed2054 100644 --- a/powerjob-server/src/main/resources/application-pre.properties +++ b/powerjob-server/src/main/resources/application-pre.properties @@ -14,7 +14,8 @@ spring.datasource.core.hikari.minimum-idle=5 oms.mongodb.enable=true spring.data.mongodb.uri=mongodb://remotehost:27017/powerjob-pre -####### Email properties(Comment out the mail properties if you do not have needs) ####### +####### Email properties(Non-core configuration properties) ####### +####### Delete the following code to disable the mail ####### spring.mail.host=smtp.qq.com spring.mail.username=zqq spring.mail.password=qqz @@ -22,7 +23,8 @@ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true -####### DingTalk properties(Comment out the DingTalk properties if you do not have needs) ####### +####### DingTalk properties(Non-core configuration properties) ####### +####### Delete the following code to disable the DingTalk ####### oms.alarm.ding.app-key=dingauqwkvxxnqskknfv oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl oms.alarm.ding.agent-id=847044348 @@ -35,6 +37,6 @@ oms.container.retention.remote=-1 ####### Cache properties ####### oms.instance.metadata.cache.size=1024 -####### Threshold in fetching server(0~100). 100 means full detection of server, in which ####### +####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which ####### ####### split-brain could be avoided while performance overhead would increase. ####### oms.accurate.select.server.percentage = 50 \ No newline at end of file diff --git a/powerjob-server/src/main/resources/application-product.properties b/powerjob-server/src/main/resources/application-product.properties index 8b6baad6..493a6abb 100644 --- a/powerjob-server/src/main/resources/application-product.properties +++ b/powerjob-server/src/main/resources/application-product.properties @@ -14,7 +14,8 @@ spring.datasource.core.hikari.minimum-idle=5 oms.mongodb.enable=true spring.data.mongodb.uri=mongodb://localhost:27017/powerjob-product -####### Email properties(Comment out the mail properties if you do not have needs) ####### +####### Email properties(Non-core configuration properties) ####### +####### Delete the following code to disable the mail ####### spring.mail.host=smtp.qq.com spring.mail.username=zqq spring.mail.password=qqz @@ -22,7 +23,8 @@ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true -####### DingTalk properties(Comment out the DingTalk properties if you do not have needs) ####### +####### DingTalk properties(Non-core configuration properties) ####### +####### Delete the following code to disable the DingTalk ####### oms.alarm.ding.app-key= oms.alarm.ding.app-secret= oms.alarm.ding.agent-id= @@ -35,6 +37,6 @@ oms.container.retention.remote=-1 ####### Cache properties ####### oms.instance.metadata.cache.size=2048 -####### Threshold in fetching server(0~100). 100 means full detection of server, in which ####### +####### Threshold in precise fetching server(0~100). 100 means full detection of server, in which ####### ####### split-brain could be avoided while performance overhead would increase. ####### oms.accurate.select.server.percentage = 50 \ No newline at end of file diff --git a/powerjob-worker-agent/pom.xml b/powerjob-worker-agent/pom.xml index 4761e8b2..49575f6a 100644 --- a/powerjob-worker-agent/pom.xml +++ b/powerjob-worker-agent/pom.xml @@ -50,6 +50,7 @@ + diff --git a/powerjob-worker-agent/src/main/java/com/github/kfcfans/powerjob/worker/MainApplication.java b/powerjob-worker-agent/src/main/java/com/github/kfcfans/powerjob/worker/MainApplication.java index ec5d3054..caebd148 100644 --- a/powerjob-worker-agent/src/main/java/com/github/kfcfans/powerjob/worker/MainApplication.java +++ b/powerjob-worker-agent/src/main/java/com/github/kfcfans/powerjob/worker/MainApplication.java @@ -11,13 +11,13 @@ import picocli.CommandLine.Command; import picocli.CommandLine.Option; /** - * 启动类 + * powerjob-worker-agent entry * * @author tjq * @since 2020/5/20 */ @Slf4j -@Command(name = "OhMyAgent", mixinStandardHelpOptions = true, version = "1.2.0", description = "OhMyScheduler-Worker agent") +@Command(name = "OhMyAgent", mixinStandardHelpOptions = true, version = "3.4.3", description = "powerjob-worker agent") public class MainApplication implements Runnable { @Option(names = {"-a", "--app"}, description = "worker-agent's name", required = true)