Search in sources :

Example 1 with ServerName

use of io.datarouter.storage.config.properties.ServerName in project datarouter by hotpads.

the class JobHandler method list.

@Handler
Mav list(OptionalString category, OptionalString keyword, OptionalBoolean enabled, OptionalBoolean disabled) {
    Optional<String> message = params.optional("jobTriggerResponseMessage");
    Mav mav = new Mav(files.jsp.admin.datarouter.job.triggersJsp);
    if (message.isPresent()) {
        mav.put("message", message.get());
    }
    Optional<String> jobCategoryName = category.getOptional();
    boolean hideEnabled = enabled.orElse(false);
    boolean hideDisabled = disabled.orElse(false);
    mav.put("serverName", serverName.get());
    mav.put("categoryRows", getJobCategoryDtos(jobCategoryName));
    LongRunningTaskSummaryDto longRunningTaskSummary = longRunningTaskService.getSummary();
    AtomicInteger rowId = new AtomicInteger();
    List<TriggerJspDto> triggerRows = jobPackageFilter.streamMatches(jobCategoryName.orElse(""), keyword.orElse(""), hideEnabled, hideDisabled).map(jobClass -> jobToTriggerJspDto(rowId.incrementAndGet(), jobClass, longRunningTaskSummary)).collect(Collectors.toList());
    mav.put("triggerRows", triggerRows);
    mav.put("legend", LongRunningTasksHandler.legend().renderFormatted());
    return mav;
}
Also used : Scanner(io.datarouter.scanner.Scanner) LongRunningTaskTrackerFactory(io.datarouter.tasktracker.service.LongRunningTaskTrackerFactory) Date(java.util.Date) JobCategoryTracker(io.datarouter.job.scheduler.JobCategoryTracker) DurationTool(io.datarouter.util.time.DurationTool) LoggerFactory(org.slf4j.LoggerFactory) OptionalString(io.datarouter.web.handler.types.optional.OptionalString) ServerName(io.datarouter.storage.config.properties.ServerName) TreeSet(java.util.TreeSet) ChangelogRecorder(io.datarouter.instrumentation.changelog.ChangelogRecorder) Inject(javax.inject.Inject) LongRunningTaskService(io.datarouter.tasktracker.service.LongRunningTaskService) StringMav(io.datarouter.web.handler.mav.imp.StringMav) LongRunningTasksHandler(io.datarouter.tasktracker.web.LongRunningTasksHandler) MessageMav(io.datarouter.web.handler.mav.imp.MessageMav) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) JobScheduler(io.datarouter.job.scheduler.JobScheduler) Duration(java.time.Duration) JobStopperService(io.datarouter.job.service.JobStopperService) InContextRedirectMav(io.datarouter.web.handler.mav.imp.InContextRedirectMav) LongRunningTaskSummaryDto(io.datarouter.tasktracker.service.LongRunningTaskService.LongRunningTaskSummaryDto) Logger(org.slf4j.Logger) DatarouterChangelogDtoBuilder(io.datarouter.instrumentation.changelog.ChangelogRecorder.DatarouterChangelogDtoBuilder) BaseJob(io.datarouter.job.BaseJob) DatarouterJobFiles(io.datarouter.job.config.DatarouterJobFiles) Mav(io.datarouter.web.handler.mav.Mav) Set(java.util.Set) StringTool(io.datarouter.util.string.StringTool) Collectors(java.util.stream.Collectors) OptionalBoolean(io.datarouter.web.handler.types.optional.OptionalBoolean) List(java.util.List) DatarouterJobPaths(io.datarouter.job.config.DatarouterJobPaths) JobPackage(io.datarouter.job.scheduler.JobPackage) BaseHandler(io.datarouter.web.handler.BaseHandler) Optional(java.util.Optional) Require(io.datarouter.util.Require) LongRunningTask(io.datarouter.tasktracker.storage.LongRunningTask) LongRunningTaskHeartBeatStatus(io.datarouter.tasktracker.storage.LongRunningTaskHeartBeatStatus) StringMav(io.datarouter.web.handler.mav.imp.StringMav) MessageMav(io.datarouter.web.handler.mav.imp.MessageMav) InContextRedirectMav(io.datarouter.web.handler.mav.imp.InContextRedirectMav) Mav(io.datarouter.web.handler.mav.Mav) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) OptionalString(io.datarouter.web.handler.types.optional.OptionalString) LongRunningTaskSummaryDto(io.datarouter.tasktracker.service.LongRunningTaskService.LongRunningTaskSummaryDto) LongRunningTasksHandler(io.datarouter.tasktracker.web.LongRunningTasksHandler) BaseHandler(io.datarouter.web.handler.BaseHandler)

Example 2 with ServerName

use of io.datarouter.storage.config.properties.ServerName in project datarouter by hotpads.

the class JobStopperService method requestStop.

/**
 * generates requests to stop a job running on the specified servers in the cluster. the requests are not processed
 * until {@link JobStopperService#stopRequestedLocalJobs} is called (see {@link DatarouterJobStopperJob})
 * @param jobName the name of the job (class) to stop
 * @param serverNames the servers on which to attempt to stop the job
 * @param username the username that requested the stop
 */
public void requestStop(String jobName, List<String> serverNames, String username) {
    Instant jobTriggerDeadline = Instant.now();
    Instant requestExpiration = jobTriggerDeadline.plus(3L, ChronoUnit.MINUTES);
    Scanner.of(serverNames).map(serverName -> new StopJobRequest(serverName, requestExpiration, jobTriggerDeadline, jobName, username)).flush(stopJobRequestDao::putMulti);
}
Also used : StopJobRequestDao(io.datarouter.job.storage.stopjobrequest.StopJobRequestDao) Scanner(io.datarouter.scanner.Scanner) DatarouterChangelogDtoBuilder(io.datarouter.instrumentation.changelog.ChangelogRecorder.DatarouterChangelogDtoBuilder) BaseJob(io.datarouter.job.BaseJob) StopJobRequest(io.datarouter.job.storage.stopjobrequest.StopJobRequest) JobWrapper(io.datarouter.job.scheduler.JobWrapper) DatarouterJobStopperJob(io.datarouter.job.job.DatarouterJobStopperJob) Instant(java.time.Instant) Singleton(javax.inject.Singleton) ServerName(io.datarouter.storage.config.properties.ServerName) Supplier(java.util.function.Supplier) ChangelogRecorder(io.datarouter.instrumentation.changelog.ChangelogRecorder) Inject(javax.inject.Inject) LocalTriggerLockService(io.datarouter.job.lock.LocalTriggerLockService) List(java.util.List) Future(java.util.concurrent.Future) ChronoUnit(java.time.temporal.ChronoUnit) JobScheduler(io.datarouter.job.scheduler.JobScheduler) ThreadTool(io.datarouter.util.concurrent.ThreadTool) Instant(java.time.Instant) StopJobRequest(io.datarouter.job.storage.stopjobrequest.StopJobRequest)

Example 3 with ServerName

use of io.datarouter.storage.config.properties.ServerName in project datarouter by hotpads.

the class TraceFilter method init.

@Override
public void init(FilterConfig filterConfig) {
    DatarouterInjector injector = getInjector(filterConfig.getServletContext());
    serverName = injector.getInstance(ServerName.class);
    trace2BufferForLocal = injector.getInstance(Trace2ForLocalFilterToMemoryBuffer.class);
    trace2BufferForPublisher = injector.getInstance(Trace2ForPublisherFilterToMemoryBuffer.class);
    traceSettings = injector.getInstance(DatarouterTraceFilterSettingRoot.class);
    urlBuilder = injector.getInstance(TraceUrlBuilder.class);
    currentSessionInfo = injector.getInstance(CurrentSessionInfo.class);
    handlerMetrics = injector.getInstance(HandlerMetrics.class);
    serviceName = injector.getInstance(ServiceName.class);
}
Also used : Trace2ForLocalFilterToMemoryBuffer(io.datarouter.trace.conveyor.local.Trace2ForLocalFilterToMemoryBuffer) DatarouterInjector(io.datarouter.inject.DatarouterInjector) ServiceName(io.datarouter.web.config.service.ServiceName) ServerName(io.datarouter.storage.config.properties.ServerName) HandlerMetrics(io.datarouter.web.handler.HandlerMetrics) Trace2ForPublisherFilterToMemoryBuffer(io.datarouter.trace.conveyor.publisher.Trace2ForPublisherFilterToMemoryBuffer) DatarouterTraceFilterSettingRoot(io.datarouter.trace.settings.DatarouterTraceFilterSettingRoot) TraceUrlBuilder(io.datarouter.trace.service.TraceUrlBuilder) CurrentSessionInfo(io.datarouter.web.user.session.CurrentSessionInfo)

Aggregations

ServerName (io.datarouter.storage.config.properties.ServerName)3 ChangelogRecorder (io.datarouter.instrumentation.changelog.ChangelogRecorder)2 DatarouterChangelogDtoBuilder (io.datarouter.instrumentation.changelog.ChangelogRecorder.DatarouterChangelogDtoBuilder)2 BaseJob (io.datarouter.job.BaseJob)2 JobScheduler (io.datarouter.job.scheduler.JobScheduler)2 Scanner (io.datarouter.scanner.Scanner)2 List (java.util.List)2 Inject (javax.inject.Inject)2 DatarouterInjector (io.datarouter.inject.DatarouterInjector)1 DatarouterJobFiles (io.datarouter.job.config.DatarouterJobFiles)1 DatarouterJobPaths (io.datarouter.job.config.DatarouterJobPaths)1 DatarouterJobStopperJob (io.datarouter.job.job.DatarouterJobStopperJob)1 LocalTriggerLockService (io.datarouter.job.lock.LocalTriggerLockService)1 JobCategoryTracker (io.datarouter.job.scheduler.JobCategoryTracker)1 JobPackage (io.datarouter.job.scheduler.JobPackage)1 JobWrapper (io.datarouter.job.scheduler.JobWrapper)1 JobStopperService (io.datarouter.job.service.JobStopperService)1 StopJobRequest (io.datarouter.job.storage.stopjobrequest.StopJobRequest)1 StopJobRequestDao (io.datarouter.job.storage.stopjobrequest.StopJobRequestDao)1 LongRunningTaskService (io.datarouter.tasktracker.service.LongRunningTaskService)1