Tabnine Logo
JobInfo.isStopped
Code IndexAdd Tabnine to your IDE (free)

How to use
isStopped
method
in
de.otto.edison.jobs.domain.JobInfo

Best Java code snippets using de.otto.edison.jobs.domain.JobInfo.isStopped (Showing top 14 results out of 315)

origin: otto-de/edison-microservice

public String getState() {
  return job.isStopped() ? "Stopped" : "Running";
}
origin: otto-de/edison-microservice

@Override
public void removeIfStopped(final String id) {
  final JobInfo jobInfo = jobs.get(id);
  if (jobInfo != null && jobInfo.isStopped()) {
    jobs.remove(id);
  }
}
origin: otto-de/edison-microservice

  private List<JobInfo> findJobsToDelete(final List<JobInfo> jobs) {
    List<JobInfo> jobsToDelete = new ArrayList<>();
    jobs.stream()
        .sorted(comparing(JobInfo::getStarted, reverseOrder()))
        .collect(groupingBy(JobInfo::getJobType))
        .forEach((jobType, jobExecutions) -> {
          jobExecutions.stream()
              .filter(j -> j.isStopped() && Objects.equals(j.getStatus(), SKIPPED))
              .skip(numberOfJobsToKeep)
              .forEach(jobsToDelete::add);
        });
    return jobsToDelete;
  }
}
origin: otto-de/edison-microservice

@Override
public List<JobInfo> findRunningWithoutUpdateSince(OffsetDateTime timeOffset) {
  return jobs.values().stream()
      .filter(jobInfo -> !jobInfo.isStopped() && jobInfo.getLastUpdated().isBefore(timeOffset))
      .collect(toList());
}
origin: otto-de/edison-microservice

private List<JobInfo> findJobsToDelete(final List<JobInfo> jobs) {
  List<JobInfo> jobsToDelete = new ArrayList<>();
  jobs.stream()
      .sorted(comparing(JobInfo::getStarted, reverseOrder()))
      .collect(groupingBy(JobInfo::getJobType))
      .forEach((jobType, jobExecutions) -> {
        Optional<JobInfo> lastOkExecution = jobExecutions.stream()
            .filter(j -> j.isStopped() && j.getStatus() == OK)
            .findFirst();
        jobExecutions.stream()
            .filter(JobInfo::isStopped)
            .skip(numberOfJobsToKeep)
            .filter(j -> !(lastOkExecution.isPresent() && lastOkExecution.get().equals(j)))
            .forEach(jobsToDelete::add);
      });
  return jobsToDelete;
}
origin: otto-de/edison-microservice

public String getStopped() {
  return job.isStopped()
      ? formatTime(job.getStopped().get())
      : "";
}
origin: otto-de/edison-microservice

/**
 * Checks all run locks and releases the lock, if the job is stopped.
 *
 * TODO: This method should never do something, otherwise the is a bug in the lock handling.
 * TODO: Check Log files + Remove
 */
private void clearRunLocks() {
  jobMetaService.runningJobs().forEach((RunningJob runningJob) -> {
    final Optional<JobInfo> jobInfoOptional = jobRepository.findOne(runningJob.jobId);
    if (jobInfoOptional.isPresent() && jobInfoOptional.get().isStopped()) {
      jobMetaService.releaseRunLock(runningJob.jobType);
      LOG.error("Clear Lock of Job {}. Job stopped already.", runningJob.jobType);
    } else if (!jobInfoOptional.isPresent()){
      jobMetaService.releaseRunLock(runningJob.jobType);
      LOG.error("Clear Lock of Job {}. JobID does not exist", runningJob.jobType);
    }
  });
}
origin: de.otto.edison/edison-mongo

@Override
public void removeIfStopped(final String id) {
  findOne(id).ifPresent(jobInfo -> {
    if (jobInfo.isStopped()) {
      collectionWithWriteTimeout(mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS).deleteOne(eq(ID, id));
    }
  });
}
origin: otto-de/edison-microservice

@Override
public void removeIfStopped(final String id) {
  findOne(id).ifPresent(jobInfo -> {
    if (jobInfo.isStopped()) {
      collectionWithWriteTimeout(mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS).deleteOne(eq(ID, id));
    }
  });
}
origin: otto-de/edison-microservice

public String getRuntime() {
  return job.isStopped()
      ? formatRuntime(job.getStarted(), job.getStopped().get())
      : formatRuntime(job.getStarted(), OffsetDateTime.now());
}
origin: otto-de/edison-microservice

@Test
public void shouldKillJobsWithoutUpdateSince() {
  JobInfo toBeKilled = defaultJobInfo("toBeKilled", 75);
  jobRepository.createOrUpdate(toBeKilled);
  jobService.killJobsDeadSince(60);
  Optional<JobInfo> expectedKilledJob = jobRepository.findOne(toBeKilled.getJobId());
  assertThat(expectedKilledJob.get().isStopped(), is(true));
  assertThat(expectedKilledJob.get().getStatus(), is(DEAD));
}
origin: otto-de/edison-microservice

@Test
public void shouldNotKillJobsThatHaveRecentlyBeenUpdated() {
  JobInfo notToBeKilled = defaultJobInfo("notToBeKilled", 45);
  jobRepository.createOrUpdate(notToBeKilled);
  jobService.killJobsDeadSince(60);
  Optional<JobInfo> expectedRunningJob = jobRepository.findOne(notToBeKilled.getJobId());
  assertThat(expectedRunningJob.get().isStopped(), is(false));
  assertThat(expectedRunningJob.get().getStatus(), is(OK));
}
origin: otto-de/edison-microservice

@Override
protected final Document encode(final JobInfo job) {
  final Document document = new Document()
      .append(JobStructure.ID.key(), job.getJobId())
      .append(JobStructure.JOB_TYPE.key(), job.getJobType())
      .append(JobStructure.STARTED.key(), Date.from(job.getStarted().toInstant()))
      .append(JobStructure.LAST_UPDATED.key(), Date.from(job.getLastUpdated().toInstant()))
      .append(JobStructure.MESSAGES.key(), job.getMessages().stream()
          .map(MongoJobRepository::encodeJobMessage)
          .collect(toList()))
      .append(JobStructure.STATUS.key(), job.getStatus().name())
      .append(JobStructure.HOSTNAME.key(), job.getHostname());
  if (job.isStopped()) {
    document.append(JobStructure.STOPPED.key(), Date.from(job.getStopped().get().toInstant()));
  }
  return document;
}
origin: de.otto.edison/edison-mongo

@Override
protected final Document encode(final JobInfo job) {
  final Document document = new Document()
      .append(JobStructure.ID.key(), job.getJobId())
      .append(JobStructure.JOB_TYPE.key(), job.getJobType())
      .append(JobStructure.STARTED.key(), DateTimeConverters.toDate(job.getStarted()))
      .append(JobStructure.LAST_UPDATED.key(), DateTimeConverters.toDate(job.getLastUpdated()))
      .append(JobStructure.MESSAGES.key(), job.getMessages().stream()
          .map(MongoJobRepository::encodeJobMessage)
          .collect(toList()))
      .append(JobStructure.STATUS.key(), job.getStatus().name())
      .append(JobStructure.HOSTNAME.key(), job.getHostname());
  if (job.isStopped()) {
    document.append(JobStructure.STOPPED.key(), DateTimeConverters.toDate(job.getStopped().get()));
  }
  return document;
}
de.otto.edison.jobs.domainJobInfoisStopped

Popular methods of JobInfo

  • getJobId
  • getJobType
  • getLastUpdated
  • getMessages
  • getStarted
  • getStatus
  • getStopped
  • newJobInfo
  • copy
  • getHostname
  • <init>
  • builder
  • <init>,
  • builder,
  • equals,
  • getClock,
  • hashCode

Popular in Java

  • Running tasks concurrently on multiple threads
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now