All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.singularity.scheduler.SingularityUsageCleanerPoller Maven / Gradle / Ivy

package com.hubspot.singularity.scheduler;

import com.google.inject.Inject;
import com.hubspot.singularity.config.SingularityConfiguration;
import com.hubspot.singularity.data.TaskManager;
import com.hubspot.singularity.data.usage.UsageManager;
import java.util.concurrent.TimeUnit;

public class SingularityUsageCleanerPoller extends SingularityLeaderOnlyPoller {
  private final UsageManager usageManager;
  private final TaskManager taskManager;

  @Inject
  SingularityUsageCleanerPoller(
    SingularityConfiguration configuration,
    UsageManager usageManager,
    TaskManager taskManager
  ) {
    super(configuration.getCleanUsageEveryMillis(), TimeUnit.MILLISECONDS);
    this.usageManager = usageManager;
    this.taskManager = taskManager;
  }

  @Override
  public void runActionOnPoll() {
    usageManager.cleanOldUsages(taskManager.getActiveTaskIds());
  }

  @Override
  protected boolean abortsOnError() {
    return false;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy