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

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

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

origin: otto-de/edison-microservice

/**
 * Returns additional information like job uri, running state, started and stopped timestamps.
 *
 * @param jobInfo the job information of the last job
 * @return map containing uri, starting, and running or stopped entries.
 */
protected Map<String, String> runningDetailsFor(final JobInfo jobInfo) {
  final Map<String, String> details = new HashMap<>();
  details.put("Started", ISO_DATE_TIME.format(jobInfo.getStarted()));
  if (jobInfo.getStopped().isPresent()) {
    details.put("Stopped", ISO_DATE_TIME.format(jobInfo.getStopped().get()));
  }
  return details;
}
origin: otto-de/edison-microservice

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

/**
 * Calculates whether or not the last job execution is too old.
 *
 * @param jobInfo job info of the last job execution
 * @param jobDefinition job definition, specifying the max age of jobs
 * @return boolean
 */
protected boolean jobTooOld(final JobInfo jobInfo, final JobDefinition jobDefinition) {
  final Optional<OffsetDateTime> stopped = jobInfo.getStopped();
  if (stopped.isPresent() && jobDefinition.maxAge().isPresent()) {
    final OffsetDateTime deadlineToRerun = stopped.get().plus(jobDefinition.maxAge().get());
    return deadlineToRerun.isBefore(now());
  }
  return false;
}
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

private JobInfo someStoppedJob(final JobInfo.JobStatus jobStatus, int startedSecondsAgo) {
  OffsetDateTime now = now();
  JobInfo someJob = mock(JobInfo.class);
  when(someJob.getJobType()).thenReturn("someJobType");
  when(someJob.getJobId()).thenReturn("someId");
  when(someJob.getStarted()).thenReturn(now.minusSeconds(startedSecondsAgo));
  when(someJob.getStopped()).thenReturn(of(now.minusSeconds(startedSecondsAgo-1)));
  when(someJob.getStatus()).thenReturn(jobStatus);
  return someJob;
}
origin: otto-de/edison-microservice

  private JobInfo someRunningJob(final JobInfo.JobStatus jobStatus, int startedSecondsAgo) {
    OffsetDateTime now = now();
    JobInfo someJob = mock(JobInfo.class);
    when(someJob.getJobType()).thenReturn("someJobType");
    when(someJob.getJobId()).thenReturn("someJobId");
    when(someJob.getStarted()).thenReturn(now.minusSeconds(startedSecondsAgo));
    when(someJob.getStopped()).thenReturn(empty());
    when(someJob.getStatus()).thenReturn(jobStatus);
    return someJob;
  }
}
origin: otto-de/edison-microservice

final String message;
final JobInfo currentJob = jobInfos.get(0);
final JobInfo lastJob = (!currentJob.getStopped().isPresent() && currentJob.getStatus() == JobStatus.OK && jobInfos.size() > 1) ? jobInfos.get(1) : jobInfos.get(0);
final JobMeta jobMeta = getJobMeta(jobDefinition.jobType());
long numFailedJobs = getNumFailedJobs(jobInfos);
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.domainJobInfogetStopped

Popular methods of JobInfo

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

Popular in Java

  • Making http requests using okhttp
  • startActivity (Activity)
  • getApplicationContext (Context)
  • getResourceAsStream (ClassLoader)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • JLabel (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top Sublime Text plugins
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