|
16 | 16 | import org.junit.Assert; |
17 | 17 | import org.junit.Test; |
18 | 18 | import org.labkey.api.data.Container; |
| 19 | +import org.labkey.api.data.SimpleFilter; |
| 20 | +import org.labkey.api.data.TableInfo; |
| 21 | +import org.labkey.api.data.TableSelector; |
19 | 22 | import org.labkey.api.pipeline.PipeRoot; |
20 | 23 | import org.labkey.api.pipeline.PipelineJob; |
21 | 24 | import org.labkey.api.pipeline.PipelineJobException; |
22 | 25 | import org.labkey.api.pipeline.PipelineJobService; |
| 26 | +import org.labkey.api.pipeline.PipelineService; |
23 | 27 | import org.labkey.api.pipeline.TaskId; |
24 | 28 | import org.labkey.api.pipeline.TaskPipeline; |
25 | 29 | import org.labkey.api.pipeline.WorkDirectory; |
| 30 | +import org.labkey.api.query.FieldKey; |
26 | 31 | import org.labkey.api.reader.Readers; |
27 | 32 | import org.labkey.api.security.User; |
28 | 33 | import org.labkey.api.sequenceanalysis.SequenceAnalysisService; |
@@ -207,9 +212,21 @@ public List<PipelineJob> createSplitJobs() |
207 | 212 | { |
208 | 213 | ArrayList<PipelineJob> jobs = new ArrayList<>(); |
209 | 214 | Map<String, List<Interval>> intervalMap = getJobToIntervalMap(); |
| 215 | + final TableInfo ti = PipelineService.get().getJobsTable(getUser(), getContainer()); |
210 | 216 | for (String name : intervalMap.keySet()) |
211 | 217 | { |
212 | | - jobs.add(createSingleContigJob(name)); |
| 218 | + // Check if exists and only create if needed: |
| 219 | + SimpleFilter filter = new SimpleFilter(FieldKey.fromString("JobParent"), getJobGUID()); |
| 220 | + filter.addCondition(FieldKey.fromString("Name"), getChildJobName(this, name)); |
| 221 | + TableSelector ts = new TableSelector(ti, filter, null); |
| 222 | + if (ts.exists()) |
| 223 | + { |
| 224 | + getLogger().debug("Child job already exists, will not re-create: " + getChildJobName(this, name)); |
| 225 | + } |
| 226 | + else |
| 227 | + { |
| 228 | + jobs.add(createSingleContigJob(name)); |
| 229 | + } |
213 | 230 | } |
214 | 231 |
|
215 | 232 | return Collections.unmodifiableList(jobs); |
@@ -275,6 +292,8 @@ private PipelineJob createSingleContigJob(String jobNameSuffix) |
275 | 292 | { |
276 | 293 | try |
277 | 294 | { |
| 295 | + String jobName = getChildJobName(this, jobNameSuffix); |
| 296 | + |
278 | 297 | VariantProcessingJob childJob = new VariantProcessingJob(this, jobNameSuffix); |
279 | 298 |
|
280 | 299 | return childJob; |
|
0 commit comments