public JobTicket startJob(QueryBatcher batcher, ConcurrentHashMap<String, JobTicket> activeJobs) { String jobId = batcher.getJobId() != null ? batcher.getJobId() : generateJobId(); if (batcher.getJobId() == null) batcher.withJobId(jobId); if (!batcher.isStarted() && activeJobs.containsKey(jobId)) { throw new DataMovementException( "Cannot start the batcher because the given job Id already exists in the active jobs", null); } JobTicket jobTicket = new JobTicketImpl(jobId, JobTicket.JobType.QUERY_BATCHER) .withQueryBatcher((QueryBatcherImpl) batcher); ((QueryBatcherImpl) batcher).start(jobTicket); activeJobs.put(jobId, jobTicket); return jobTicket; }
public JobTicket startJob(WriteBatcher batcher, ConcurrentHashMap<String, JobTicket> activeJobs) { String jobId = batcher.getJobId() != null ? batcher.getJobId() : generateJobId(); if (batcher.getJobId() == null && ! batcher.isStarted() ) batcher.withJobId(jobId); if (!batcher.isStarted() && activeJobs.containsKey(jobId)) { throw new DataMovementException( "Cannot start the batcher because the given job Id already exists in the active jobs", null); } JobTicket jobTicket = new JobTicketImpl(jobId, JobTicket.JobType.WRITE_BATCHER) .withWriteBatcher((WriteBatcherImpl) batcher); ((WriteBatcherImpl) batcher).start(jobTicket); activeJobs.put(jobId, jobTicket); return jobTicket; }
job.withJobOutput(errors.toString()); jobManager.saveJob(job); return new JobTicketImpl(jobId, JobTicket.JobType.QUERY_BATCHER);