Skip to content

Commit

Permalink
branch-3.0: [Chore](Job)Add scheduling logs for periodic jobs. #44843 (
Browse files Browse the repository at this point in the history
…#45070)

Cherry-picked from #44843

Co-authored-by: Calvin Kirs <[email protected]>
  • Loading branch information
github-actions[bot] and CalvinKirs authored Dec 6, 2024
1 parent b12d0eb commit 4511e0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public void run(Timeout timeout) {
log.warn("dispatch timer job failed, queue maybe full. job id is {}, job name is {}",
this.job.getJobId(), this.job.getJobName() + getMsgWhenExecuteQueueFull());
}
log.info("dispatch timer job success, job id is {}, job name is {}", this.job.getJobId(),
this.job.getJobName());
} catch (Exception e) {
log.warn("dispatch timer job error, task id is {}", this.job.getJobId(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ public void close() throws IOException {
private void cycleTimerJobScheduler(T job, long startTimeWindowMs) {
List<Long> delaySeconds = job.getJobConfig().getTriggerDelayTimes(System.currentTimeMillis(),
startTimeWindowMs, latestBatchSchedulerTimerTaskTimeMs);
if (CollectionUtils.isEmpty(delaySeconds)) {
log.info("skip job {} scheduler timer job, delay seconds is empty", job.getJobName());
return;
}
log.info("job {} scheduler timer job, delay seconds size is {}", job.getJobName(), delaySeconds.size());
if (CollectionUtils.isNotEmpty(delaySeconds)) {
delaySeconds.forEach(delaySecond -> {
TimerJobSchedulerTask<T> timerJobSchedulerTask = new TimerJobSchedulerTask<>(timerJobDisruptor, job);
Expand Down Expand Up @@ -186,6 +191,8 @@ private void executeTimerJobIdsWithinLastTenMinutesWindow() {
this.latestBatchSchedulerTimerTaskTimeMs = System.currentTimeMillis();
}
this.latestBatchSchedulerTimerTaskTimeMs += BATCH_SCHEDULER_INTERVAL_MILLI_SECONDS;
log.info("execute timer job ids within last ten minutes window, last time window is {}",
TimeUtils.longToTimeString(lastTimeWindowMs));
if (jobMap.isEmpty()) {
return;
}
Expand All @@ -207,6 +214,7 @@ private void clearEndJob(T job) {
}
try {
Env.getCurrentEnv().getJobManager().unregisterJob(job.getJobId());
log.info("clear finish job, job id is {}, job name is {}", job.getJobId(), job.getJobName());
} catch (JobException e) {
log.error("clear finish job error, job id is {}", job.getJobId(), e);
}
Expand Down

0 comments on commit 4511e0f

Please sign in to comment.