Kaynağa Gözat

docs: review translation

tjq 4 yıl önce
ebeveyn
işleme
5feaf6106e

+ 3 - 3
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()) {

+ 3 - 1
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);
 

+ 2 - 2
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;
 }

+ 1 - 4
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.
      */

+ 13 - 16
powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java

@@ -71,20 +71,17 @@ public class SystemMetrics implements OmsSerializable, Comparable<SystemMetrics>
      * @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<SystemMetrics>
      * 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<SystemMetrics>
             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;
         }

+ 2 - 6
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;
     /**

+ 2 - 3
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.

+ 5 - 3
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

+ 5 - 3
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

+ 5 - 3
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

+ 1 - 0
powerjob-worker-agent/pom.xml

@@ -50,6 +50,7 @@
     </dependencies>
 
 
+    <!-- 谁说SpringBoot的打包插件只能给SpringBoot用的?省的我写一堆配置还有BUG... -->
     <build>
         <plugins>
             <plugin>

+ 2 - 2
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)