|
@@ -5,7 +5,8 @@ import com.helospark.lightdi.LightDi;
|
|
|
import com.helospark.lightdi.LightDiContext;
|
|
|
import com.helospark.lightdi.annotation.Autowired;
|
|
|
import com.helospark.lightdi.annotation.Service;
|
|
|
-import com.winhc.dataworks.flow.touch.bean.OdpsTableSchema;
|
|
|
+import com.winhc.dataworks.flow.touch.bean.DataWorksFlowJob;
|
|
|
+import com.winhc.dataworks.flow.touch.bean.DataWorksFlowTask;
|
|
|
import com.winhc.dataworks.flow.touch.bean.TaskFlowEnum;
|
|
|
import com.winhc.dataworks.flow.touch.bean.TaskParam;
|
|
|
import com.winhc.dataworks.flow.touch.configuration.SchemaInit;
|
|
@@ -13,7 +14,7 @@ import com.winhc.dataworks.flow.touch.service.TouchService;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@@ -28,30 +29,31 @@ public class TestMain {
|
|
|
TouchService touchService;
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- if (args.length != 1) {
|
|
|
- System.out.println("请输入调度的表名");
|
|
|
+ if (args.length != 3) {
|
|
|
+ System.out.println("请输入调度的 业务流程名 任务名 bizDate");
|
|
|
System.exit(-9999);
|
|
|
}
|
|
|
LightDiContext context = LightDi.initContextByPackage(TestMain.class.getPackage().getName());
|
|
|
TestMain bean = context.getBean(TestMain.class);
|
|
|
- bean.start(args[0]);
|
|
|
+ bean.start(args[0], args[1], args[2]);
|
|
|
}
|
|
|
|
|
|
@SneakyThrows
|
|
|
- public void start(String tableName) {
|
|
|
- OdpsTableSchema odpsTableSchema = SchemaInit.MAP.get(tableName);
|
|
|
+ public void start(String flow, String taskName, String bizDate) {
|
|
|
+ List<DataWorksFlowJob> jobs = SchemaInit.LIST;
|
|
|
+ DataWorksFlowJob dataWorksFlowJob = jobs.stream().filter(j -> j.getFlow().equals(flow)).findFirst().orElseThrow(NullPointerException::new);
|
|
|
+
|
|
|
+ DataWorksFlowTask dataWorksFlowTask = dataWorksFlowJob.getTask().stream().filter(t -> t.getTaskName().equals(taskName)).findFirst().orElseThrow(NullPointerException::new);
|
|
|
|
|
|
- HashMap<String, String> map = new HashMap<>();
|
|
|
- map.put("700003366764", odpsTableSchema.toNodePara());
|
|
|
TaskParam build = TaskParam.builder()
|
|
|
- .projectName("winhc_test")
|
|
|
- .bizDate("2020-06-22")
|
|
|
- .flowName("增量处理流程_spark")
|
|
|
- .nodeParam(map)
|
|
|
+ .projectName(dataWorksFlowJob.getProject())
|
|
|
+ .bizDate(bizDate)
|
|
|
+ .flowName(dataWorksFlowJob.getFlow())
|
|
|
+ .nodeParam(dataWorksFlowTask.toNodeParam())
|
|
|
.build();
|
|
|
CreateManualDagResponse touch = touchService.touch(build);
|
|
|
while (true) {
|
|
|
- Map<String, TaskFlowEnum> query = touchService.query("winhc_test", touch.getReturnValue());
|
|
|
+ Map<String, TaskFlowEnum> query = touchService.query(dataWorksFlowJob.getProject(), touch.getReturnValue());
|
|
|
long count = query.values()
|
|
|
.stream()
|
|
|
.filter(e -> !(TaskFlowEnum.SUCCESS.equals(e) || TaskFlowEnum.FAILURE.equals(e)))
|