Junjie
2026-04-27 2cc61346cc0a3e5338aa8957f79f4c99c204f339
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.zy.ai.timer;
 
import com.zy.ai.service.AutoTuneCoordinatorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
@Slf4j
@Component
public class AutoTuneScheduler {
 
    @Autowired
    private AutoTuneCoordinatorService autoTuneCoordinatorService;
 
    @Scheduled(cron = "0 * * * * ? ")
    public void runAutoTune() {
        try {
            AutoTuneCoordinatorService.AutoTuneCoordinatorResult result =
                    autoTuneCoordinatorService.runAutoTuneIfEligible();
            if (Boolean.TRUE.equals(result.getSkipped())) {
                log.debug("Auto tune scheduler skipped, reason={}", result.getReason());
                return;
            }
            log.info("Auto tune scheduler triggered, success={}",
                    result.getAgentResult() == null ? null : result.getAgentResult().getSuccess());
        } catch (Exception exception) {
            log.error("Auto tune scheduler failed", exception);
        }
    }
}