Search in sources :

Example 21 with Job

use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.

the class SchedulerService method updateJob.

public Job updateJob(JobScheduleRequest scheduleRequest) throws IllegalAccessException, IOException, SchedulerException {
    Job job = getScheduler().getJob(scheduleRequest.getJobId());
    if (job != null) {
        scheduleRequest.getJobParameters().add(new JobScheduleParam(QuartzScheduler.RESERVEDMAPKEY_ACTIONUSER, job.getUserName()));
    }
    Job newJob = createJob(scheduleRequest);
    removeJob(scheduleRequest.getJobId());
    return newJob;
}
Also used : JobScheduleParam(org.pentaho.platform.web.http.api.resources.JobScheduleParam) Job(org.pentaho.platform.api.scheduler2.Job)

Example 22 with Job

use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.

the class SchedulerService method pauseJob.

public JobState pauseJob(String jobId) throws SchedulerException {
    Job job = getJob(jobId);
    if (isScheduleAllowed() || PentahoSessionHolder.getSession().getName().equals(job.getUserName())) {
        getScheduler().pauseJob(jobId);
    }
    job = getJob(jobId);
    return job.getState();
}
Also used : Job(org.pentaho.platform.api.scheduler2.Job)

Example 23 with Job

use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.

the class SchedulerService method resumeJob.

public JobState resumeJob(String jobId) throws SchedulerException {
    Job job = getJob(jobId);
    if (isScheduleAllowed() || PentahoSessionHolder.getSession().getName().equals(job.getUserName())) {
        getScheduler().resumeJob(jobId);
    }
    job = getJob(jobId);
    return job.getState();
}
Also used : Job(org.pentaho.platform.api.scheduler2.Job)

Example 24 with Job

use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.

the class RepositoryCleanerSystemListenerTest method removesJobs_WhenDisabled.

@Test
public void removesJobs_WhenDisabled() throws Exception {
    final String jobId = "jobId";
    Job job = new Job();
    job.setJobId(jobId);
    when(scheduler.getJobs(any(IJobFilter.class))).thenReturn(Collections.singletonList(job));
    prepareMp();
    listener.setGcEnabled(false);
    assertTrue(listener.startup(null));
    verifyJobRemoved(jobId);
}
Also used : IJobFilter(org.pentaho.platform.api.scheduler2.IJobFilter) Job(org.pentaho.platform.api.scheduler2.Job) Test(org.junit.Test)

Example 25 with Job

use of com.google.cloud.dataproc.v1beta2.Job in project pentaho-platform by pentaho.

the class RepositoryCleanerSystemListenerTest method reschedulesJob_IfFoundDifferent.

@Test
public void reschedulesJob_IfFoundDifferent() throws Exception {
    final String oldJobId = "oldJobId";
    Job oldJob = new Job();
    oldJob.setJobTrigger(new CronJobTrigger());
    oldJob.setJobId(oldJobId);
    when(scheduler.getJobs(any(IJobFilter.class))).thenReturn(Collections.singletonList(oldJob));
    prepareMp();
    listener.setExecute(Frequency.NOW.getValue());
    assertTrue(listener.startup(null));
    verifyJobRemoved(oldJobId);
    verifyJobCreated(Frequency.NOW);
}
Also used : IJobFilter(org.pentaho.platform.api.scheduler2.IJobFilter) Job(org.pentaho.platform.api.scheduler2.Job) CronJobTrigger(org.pentaho.platform.api.scheduler2.CronJobTrigger) Test(org.junit.Test)

Aggregations

Job (org.pentaho.platform.api.scheduler2.Job)94 Test (org.junit.Test)69 Serializable (java.io.Serializable)25 SimpleJobTrigger (org.pentaho.platform.api.scheduler2.SimpleJobTrigger)21 HashMap (java.util.HashMap)20 ArrayList (java.util.ArrayList)19 JobScheduleRequest (org.pentaho.platform.web.http.api.resources.JobScheduleRequest)19 ComplexJobTrigger (org.pentaho.platform.api.scheduler2.ComplexJobTrigger)18 SchedulerException (org.pentaho.platform.api.scheduler2.SchedulerException)17 Date (java.util.Date)14 IJobFilter (org.pentaho.platform.api.scheduler2.IJobFilter)14 Job (com.google.cloud.video.transcoder.v1.Job)13 TranscoderServiceClient (com.google.cloud.video.transcoder.v1.TranscoderServiceClient)13 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)12 IJobTrigger (org.pentaho.platform.api.scheduler2.IJobTrigger)12 AudioStream (com.google.cloud.video.transcoder.v1.AudioStream)8 JobConfig (com.google.cloud.video.transcoder.v1.JobConfig)8 VideoStream (com.google.cloud.video.transcoder.v1.VideoStream)8 Map (java.util.Map)8 CronJobTrigger (org.pentaho.platform.api.scheduler2.CronJobTrigger)8