Skip to content

Commit

Permalink
Merge pull request #170 from stelin/1.x
Browse files Browse the repository at this point in the history
Openjob API
  • Loading branch information
stelin authored Feb 24, 2024
2 parents eab6210 + a30602d commit f6516c6
Show file tree
Hide file tree
Showing 103 changed files with 2,135 additions and 515 deletions.
2 changes: 1 addition & 1 deletion openjob-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>openjob</artifactId>
<groupId>io.openjob</groupId>
<version>1.0.7</version>
<version>1.0.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openjob-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class DateUtilTest {
@Test
public void testFormatDateByTimestamp() {
Integer dateTime = DateUtil.formatDateByTimestamp(DateUtil.timestamp());
Integer dateTime = DateUtil.formatDateByTimestamp(DateUtil.timestamp()* 1000);
Integer HourTime = DateUtil.formatHourByTimestamp(DateUtil.timestamp());

Assertions.assertNotNull(dateTime);
Expand Down
2 changes: 1 addition & 1 deletion openjob-server/openjob-server-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>openjob-server</artifactId>
<groupId>io.openjob</groupId>
<version>1.0.7</version>
<version>1.0.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openjob-server-admin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import javax.validation.constraints.NotNull;

/**
* @author zhenghongyang <[email protected]>
* @author zhenghongyang [email protected]
* @since 1.0.0
*/
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import javax.validation.constraints.NotNull;

/**
* @author zhenghongyang <[email protected]>
* @author zhenghongyang [email protected]
* @since 1.0.0
*/
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import javax.validation.constraints.NotNull;

/**
* @author zhenghongyang <[email protected]>
* @author zhenghongyang [email protected]
* @since 1.0.0
*/
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.openjob.server.common.vo.PageVO;

/**
* @author zhenghongyang <[email protected]>
* @author zhenghongyang [email protected]
* @since 1.0.0
*/
public interface JobService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.stream.Collectors;

/**
* @author zhenghongyang <[email protected]>
* @author zhenghongyang [email protected]
* @since 1.0.0
*/
@Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
import java.util.stream.Collectors;

/**
* @author zhenghongyang <[email protected]>
* @author zhenghongyang [email protected]
* @since 1.0.0
*/
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import lombok.Data;

/**
* @author zhenghongyang <[email protected]>
* @author zhenghongyang [email protected]
* @since 1.0.0
*/
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.Data;

/**
* @author zhenghongyang <[email protected]>
* @author zhenghongyang [email protected]
* @since 1.0.0
*/
@Data
Expand Down
2 changes: 1 addition & 1 deletion openjob-server/openjob-server-alarm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>openjob-server</artifactId>
<groupId>io.openjob</groupId>
<version>1.0.7</version>
<version>1.0.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openjob-server-alarm</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion openjob-server/openjob-server-cluster/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>openjob-server</artifactId>
<groupId>io.openjob</groupId>
<version>1.0.7</version>
<version>1.0.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import akka.routing.RoundRobinPool;
import com.typesafe.config.Config;
import io.openjob.common.constant.AkkaConstant;
import io.openjob.server.cluster.manager.FailManager;
import io.openjob.server.cluster.common.FailCommon;
import io.openjob.server.cluster.service.ClusterService;
import io.openjob.server.cluster.service.JoinService;
import io.openjob.server.common.ClusterContext;
Expand All @@ -29,16 +29,16 @@ public class ClusterServer {
private final ActorSystem actorSystem;
private final SchedulerProperties schedulerProperties;
private final JoinService joinService;
private final FailManager failManager;
private final FailCommon failCommon;
private final ClusterService clusterService;

@Autowired
public ClusterServer(ActorSystem actorSystem, SchedulerProperties schedulerProperties, JoinService joinService, FailManager failManager, ClusterService clusterService) {
public ClusterServer(ActorSystem actorSystem, SchedulerProperties schedulerProperties, JoinService joinService, FailCommon failCommon, ClusterService clusterService) {
this.actorSystem = actorSystem;
this.schedulerProperties = schedulerProperties;
this.joinService = joinService;

this.failManager = failManager;
this.failCommon = failCommon;
this.clusterService = clusterService;
}

Expand Down Expand Up @@ -148,7 +148,7 @@ private void registerCoordinatedShutdown() {
.addTask(CoordinatedShutdown.PhaseServiceUnbind(),
"coordinated-shutdown-hook",
() -> {
this.failManager.shutdown(ClusterContext.getCurrentNode());
this.failCommon.shutdown(ClusterContext.getCurrentNode());
return Future.successful(Done.done());
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.openjob.server.cluster.manager;
package io.openjob.server.cluster.common;

import com.google.common.collect.Maps;
import io.openjob.common.OpenjobSpringContext;
Expand Down Expand Up @@ -33,15 +33,15 @@
*/
@Slf4j
@Component
public class FailManager {
public class FailCommon {
private final ServerDAO serverDAO;
private final JobSlotsDAO jobSlotsDAO;
private final ClusterProperties clusterProperties;
private final RefreshData refreshData;
private final Scheduler scheduler;

@Autowired
public FailManager(ServerDAO serverDAO, JobSlotsDAO jobSlotsDAO, ClusterProperties clusterProperties, RefreshData refreshData, Scheduler scheduler) {
public FailCommon(ServerDAO serverDAO, JobSlotsDAO jobSlotsDAO, ClusterProperties clusterProperties, RefreshData refreshData, Scheduler scheduler) {
this.serverDAO = serverDAO;
this.jobSlotsDAO = jobSlotsDAO;
this.clusterProperties = clusterProperties;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.openjob.server.cluster.manager;
package io.openjob.server.cluster.common;

import com.google.common.collect.Maps;
import io.openjob.common.OpenjobSpringContext;
Expand Down Expand Up @@ -29,7 +29,7 @@
*/
@Slf4j
@Component
public class JoinManager {
public class JoinCommon {
private final ServerDAO serverDAO;
private final JobSlotsDAO jobSlotsDAO;
private final RefreshData refreshData;
Expand All @@ -39,7 +39,7 @@ public class JoinManager {
* Refresh status.
*/
@Autowired
public JoinManager(ServerDAO serverDAO, JobSlotsDAO jobSlotsDAO, RefreshData refreshData, ClusterProperties clusterProperties) {
public JoinCommon(ServerDAO serverDAO, JobSlotsDAO jobSlotsDAO, RefreshData refreshData, ClusterProperties clusterProperties) {
this.serverDAO = serverDAO;
this.jobSlotsDAO = jobSlotsDAO;
this.refreshData = refreshData;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.openjob.server.cluster.dto;

import lombok.Data;

import java.util.List;

/**
* @author stelin [email protected]
* @since 1.0.8
*/
@Data
public class WorkerHeartbeatReqDTO {
private Long appId;

private String appName;

private String address;

private String version;

/**
* Running job instance ids.
*/
private List<Long> runningJobInstanceIds;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.openjob.server.cluster.dto;

import lombok.Data;

import java.util.Set;

/**
* @author stelin [email protected]
* @since 1.0.8
*/
@Data
public class WorkerHeartbeatRespDTO {

/**
* Worker address list.
*/
private Set<String> workerAddressList;

/**
* Cluster version
*/
private Long clusterVersion;

/**
* Cluster delay version
*/
private Long clusterDelayVersion;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package io.openjob.server.cluster.dto;

import io.openjob.common.constant.FailStatusEnum;
import io.openjob.common.constant.InstanceStatusEnum;
import lombok.Data;

/**
* @author stelin [email protected]
* @since 1.0.8
*/
@Data
public class WorkerJobInstanceStatusReqDTO {
/**
* Job id.
*/
private Long jobId;

/**
* Job instance id.
*/
private Long jobInstanceId;

/**
* Current circleId.
* Only for second delay task.
*/
private Long circleId;

/**
* Job instance status.
*
* @see InstanceStatusEnum
*/
private Integer status;

/**
* Fail status
*
* @see FailStatusEnum#getStatus()
*/
private Integer failStatus;

/**
* Result
*/
private String result;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.openjob.server.cluster.dto;

import lombok.Data;

/**
* @author stelin [email protected]
* @since 1.0.8
*/
@Data
public class WorkerJobInstanceStatusRespDTO {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package io.openjob.server.cluster.dto;

import lombok.Data;

import java.util.List;

/**
* @author stelin [email protected]
* @since 1.0.8
*/
@Data
public class WorkerJobInstanceTaskBatchReqDTO {
private List<WorkerJobInstanceTaskReqDTO> taskRequestList;

@Data
public static class WorkerJobInstanceTaskReqDTO {
/**
* Job id.
*/
private Long jobId;

/**
* Job instance id.
*/
private Long jobInstanceId;

/**
* Dispatch version
*/
private Long dispatchVersion;

/**
* Only for second delay task.
*/
private Long circleId;

/**
* Task unique id.
* like 'jobId_instanceId_taskId_circleId'
*/
private String taskId;

/**
* Task parent unique id.
* like 'jobId_instanceId_taskId_circleId'
*/
private String parentTaskId;

/**
* Task name.
* Only for map reduce task.
*/
private String taskName;

/**
* Task status.
*/
private Integer status;

/**
* Task result.
*/
private String result;

/**
* Task worker address
*/
private String workerAddress;

/**
* Task create time.
*/
private Long createTime;

/**
* Task update time.
*/
private Long updateTime;
}
}
Loading

0 comments on commit f6516c6

Please sign in to comment.