perf(scheduler): 优化批量压缩调度接口
This commit is contained in:
@@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import com.lanyuanxiaoyao.service.common.Constants;
|
||||
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
||||
import com.lanyuanxiaoyao.service.configuration.utils.QueueUtil;
|
||||
import com.lanyuanxiaoyao.service.forest.service.HudiService;
|
||||
import com.lanyuanxiaoyao.service.forest.service.InfoService;
|
||||
@@ -34,6 +35,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -141,6 +144,22 @@ public class ScheduleController {
|
||||
);
|
||||
}
|
||||
|
||||
@PostMapping("tables")
|
||||
public void scheduleTables(@RequestBody ImmutableList<JobIdAndAlias> list) {
|
||||
if (list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
ImmutableList<String> keys = list.collect(item -> StrUtil.format("{}-{}", item.getId(), item.getAlias()));
|
||||
ScheduleHelper.schedule(
|
||||
discoveryClient,
|
||||
infoService,
|
||||
hudiService,
|
||||
mapper,
|
||||
meta -> keys.contains(StrUtil.format("{}-{}", meta.getJob().getId(), meta.getAlias())),
|
||||
"Schedule manually"
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("stop_all")
|
||||
public void stopTheWorld(
|
||||
@RequestParam("flink_job_id") Long flinkJobId,
|
||||
|
||||
@@ -45,8 +45,7 @@ public class DailyScheduleJob extends BaseScheduleJob {
|
||||
hudiService,
|
||||
mapper,
|
||||
meta -> true,
|
||||
comment,
|
||||
Maps.immutable.empty()
|
||||
comment
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,7 @@ public class FocusScheduleJob extends BaseScheduleJob {
|
||||
hudiService,
|
||||
mapper,
|
||||
meta -> meta.getPriority() >= 10000,
|
||||
comment,
|
||||
Maps.immutable.empty()
|
||||
comment
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,7 @@ public class FocusUnVersionUpdateScheduleJob extends BaseScheduleJob {
|
||||
mapper,
|
||||
meta -> meta.getPriority() >= 10000
|
||||
&& unUpdateVersionTableIds.contains(StrUtil.format("{}-{}", meta.getJob().getId(), meta.getAlias())),
|
||||
comment,
|
||||
Maps.immutable.empty()
|
||||
comment
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ public class OdsFocusScheduleJob extends BaseScheduleJob {
|
||||
hudiService,
|
||||
mapper,
|
||||
meta -> TableMetaHelper.existsTag(meta, Constants.TAGS_ODS_FOCUS),
|
||||
comment,
|
||||
Maps.immutable.empty()
|
||||
comment
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,17 @@ public class ScheduleHelper {
|
||||
return LabelMarker.of(() -> Maps.mutable.of(Constants.LOG_FLINK_JOB_ID, flinkJobId.toString(), Constants.LOG_ALIAS, alias));
|
||||
}
|
||||
|
||||
public static void schedule(
|
||||
DiscoveryClient discoveryClient,
|
||||
InfoService infoService,
|
||||
HudiService hudiService,
|
||||
ObjectMapper mapper,
|
||||
Predicate<TableMeta> predicate,
|
||||
String comment
|
||||
) {
|
||||
schedule(discoveryClient, infoService, hudiService, mapper, predicate, comment, Maps.immutable.empty());
|
||||
}
|
||||
|
||||
public static void schedule(
|
||||
DiscoveryClient discoveryClient,
|
||||
InfoService infoService,
|
||||
|
||||
Reference in New Issue
Block a user