Projects >> seqware >>c9d3d21ed57ca2ee61e6d227156e19a0246a641a

Chunk
Conflicting content
        if (!job.getParentAccessions().isEmpty()) {
            pjob.setParentAccessions(job.getParentAccessions());
        }
<<<<<<< HEAD
      
      this.jobs.add(pjob);
      for (Job parent : job.getParents()) {
        pjob.addParent(this.getOozieJobObject((AbstractJob) parent));
      }

      // has provisionfiles dependency?
      // this based on the assumption that the provisionFiles job is always in
      // the beginning or the end.
      if (job.getFiles().isEmpty() == false) {
        for (SqwFile file : job.getFiles()) {
          // create a provisionfile job\
          if (file.isInput()) {
            // create a provisionFileJob;
            AbstractJob pfjob = new BashJob("provisionFile_in");
            pfjob.addFile(file);
            OozieProvisionFileJob parentPfjob = new OozieProvisionFileJob(pfjob, file, pfjob.getAlgo() + "_"
                + jobs.size(), this.unqiueWorkingDir, this.useSge, this.seqwareJar, this.threadsSgeParamFormat,
                                                                          this.maxMemorySgeParamFormat);
            parentPfjob.addParent(oJob0);
            parentPfjob.setMetadataWriteback(metadatawriteback);
            if (workflowRunAccession != null && !workflowRunAccession.isEmpty()) {
              parentPfjob.setWorkflowRunAccession(workflowRunAccession);
            }
            // SEQWARE-1804 transfer setParentAccessions information ala Pegasus version in net.sourceforge.seqware.pipeline.workflowV2.engine.pegasus.object.Adag 
              if (!file.getParentAccessions().isEmpty()) {
                  parentPfjob.setParentAccessions(file.getParentAccessions());
              }
            this.jobs.add(parentPfjob);
            parentPfjob.setOutputDir("provisionfiles/" + file.getUniqueDir());
            pjob.addParent(parentPfjob);
            // add mkdir to the first job, then set the file path
            job0.getCommand().addArgument("mkdir -p " + "provisionfiles/" + file.getUniqueDir() + "; ");
          } else {
            // create a provisionFileJob;
            AbstractJob pfjob = new BashJob("provisionFile_out");
            pfjob.addFile(file);
            OozieProvisionFileJob parentPfjob = new OozieProvisionFileJob(pfjob, file, pfjob.getAlgo() + "_"
                + jobs.size(), this.unqiueWorkingDir, this.useSge, this.seqwareJar, this.threadsSgeParamFormat,
                                                                          this.maxMemorySgeParamFormat);
            parentPfjob.addParent(pjob);
            parentPfjob.setMetadataWriteback(metadatawriteback);
            parentPfjob.setMetadataOutputPrefix(wfdm.getMetadata_output_file_prefix());
            parentPfjob.setOutputDir(wfdm.getMetadata_output_dir());
            if (workflowRunAccession != null && !workflowRunAccession.isEmpty()) {
              parentPfjob.setWorkflowRunAccession(workflowRunAccession);
=======
        
        //need to remember the provisionOut and reset the job's children to provisionout's children
        Map hasProvisionOut = new HashMap();
        for(AbstractJob job: wfdm.getWorkflow().getJobs()) {
            OozieJob pjob = this.createOozieJobObject(job, wfdm);
            pjob.setMetadataWriteback(metadatawriteback);
            if(workflowRunAccession!=null && !workflowRunAccession.isEmpty()) {
                pjob.setWorkflowRunAccession(workflowRunAccession);
            }
            this.jobs.add(pjob);
            for(Job parent: job.getParents()) {
                pjob.addParent(this.getOozieJobObject((AbstractJob)parent));
            }
            
            
            //has provisionfiles dependency?
            // this based on the assumption that the provisionFiles job is always in the beginning or the end.
            if(job.getFiles().isEmpty() == false) {
                for(SqwFile file: job.getFiles()) {
                    //create a provisionfile job\
                    if(file.isInput()) {                    
                            //create a provisionFileJob;
                            AbstractJob pfjob = new BashJob("provisionFile_in");
                            pfjob.addFile(file);
                            OozieProvisionFileJob parentPfjob = new OozieProvisionFileJob(pfjob, file,
                                    pfjob.getAlgo()+"_"+jobs.size(), this.unqiueWorkingDir);
                            parentPfjob.addParent(oJob0);
                            parentPfjob.setMetadataWriteback(metadatawriteback);
                            if(workflowRunAccession!=null && !workflowRunAccession.isEmpty()) {
                                parentPfjob.setWorkflowRunAccession(workflowRunAccession);
                            }
                            this.jobs.add(parentPfjob);
                            parentPfjob.setOutputDir("provisionfiles/"+file.getUniqueDir()) ;
                            pjob.addParent(parentPfjob);    
                            //add mkdir to the first job, then set the file path
                            job0.getCommand().addArgument("mkdir -p " + "provisionfiles/"+file.getUniqueDir() + "; ");
                    } else {
                            //create a provisionFileJob;
                            AbstractJob pfjob = new BashJob("provisionFile_out");
                            pfjob.addFile(file);
                            OozieProvisionFileJob parentPfjob = new OozieProvisionFileJob(pfjob, file,
                                    pfjob.getAlgo()+"_"+jobs.size(), this.unqiueWorkingDir);
                            parentPfjob.addParent(pjob);
                            parentPfjob.setMetadataWriteback(metadatawriteback);
                            parentPfjob.setMetadataOutputPrefix(wfdm.getMetadata_output_file_prefix());
                            parentPfjob.setOutputDir(wfdm.getMetadata_output_dir());
                            if(workflowRunAccession!=null && !workflowRunAccession.isEmpty()) {
                                parentPfjob.setWorkflowRunAccession(workflowRunAccession);
                            }
                            this.jobs.add(parentPfjob);
                            hasProvisionOut.put(pjob, parentPfjob);
                    }
                }
            }
            
            //if no parent, set parents after provisionfiles
            if(pjob.getParents().isEmpty()) {
                for(OozieJob parent: parents) {
                    pjob.addParent(parent);
                }
            }
        }
        
        // what is this for? Theory is that setting up dependencies between jobs may have been used as a rate-limiting mechanism
//        if(!hasProvisionOut.isEmpty()) {
//            for(Map.Entry entry: hasProvisionOut.entrySet()) {
//                //get all children
//                Collection children = entry.getKey().getChildren();
//                if(children.size()<=1)
//                    continue;
//                // and set other's parent as the value
//                for(OozieJob child: children ) {
//                    if(child == entry.getValue())
//                        continue;
//                    child.addParent(entry.getValue());
//                }
//            }
//        }
        
        //add all provision out job
        //get all the leaf job
        List leaves = new ArrayList();
        for(OozieJob _job: this.jobs) {
            if(_job.getChildren().isEmpty()) {
                leaves.add(_job);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
            }
            // SEQWARE-1804 transfer setParentAccessions information ala Pegasus version in net.sourceforge.seqware.pipeline.workflowV2.engine.pegasus.object.Adag 
              if (!file.getParentAccessions().isEmpty()) {
Solution content
        if (!job.getParentAccessions().isEmpty()) {
            pjob.setParentAccessions(job.getParentAccessions());
        }
      
      this.jobs.add(pjob);
      for (Job parent : job.getParents()) {
        pjob.addParent(this.getOozieJobObject((AbstractJob) parent));
      }

      // has provisionfiles dependency?
      // this based on the assumption that the provisionFiles job is always in
      // the beginning or the end.
      if (job.getFiles().isEmpty() == false) {
        for (SqwFile file : job.getFiles()) {
          // create a provisionfile job\
          if (file.isInput()) {
            // create a provisionFileJob;
            AbstractJob pfjob = new BashJob("provisionFile_in");
            pfjob.addFile(file);
            OozieProvisionFileJob parentPfjob = new OozieProvisionFileJob(pfjob, file, pfjob.getAlgo() + "_"
                + jobs.size(), this.unqiueWorkingDir, this.useSge, this.seqwareJar, this.threadsSgeParamFormat,
                                                                          this.maxMemorySgeParamFormat);
            parentPfjob.addParent(oJob0);
            parentPfjob.setMetadataWriteback(metadatawriteback);
            if (workflowRunAccession != null && !workflowRunAccession.isEmpty()) {
              parentPfjob.setWorkflowRunAccession(workflowRunAccession);
            }
            // SEQWARE-1804 transfer setParentAccessions information ala Pegasus version in net.sourceforge.seqware.pipeline.workflowV2.engine.pegasus.object.Adag 
              if (!file.getParentAccessions().isEmpty()) {
                  parentPfjob.setParentAccessions(file.getParentAccessions());
              }
            this.jobs.add(parentPfjob);
            parentPfjob.setOutputDir("provisionfiles/" + file.getUniqueDir());
            pjob.addParent(parentPfjob);
            // add mkdir to the first job, then set the file path
            job0.getCommand().addArgument("mkdir -p " + "provisionfiles/" + file.getUniqueDir() + "; ");
          } else {
            // create a provisionFileJob;
            AbstractJob pfjob = new BashJob("provisionFile_out");
            pfjob.addFile(file);
            OozieProvisionFileJob parentPfjob = new OozieProvisionFileJob(pfjob, file, pfjob.getAlgo() + "_"
                + jobs.size(), this.unqiueWorkingDir, this.useSge, this.seqwareJar, this.threadsSgeParamFormat,
                                                                          this.maxMemorySgeParamFormat);
            parentPfjob.addParent(pjob);
            parentPfjob.setMetadataWriteback(metadatawriteback);
            parentPfjob.setMetadataOutputPrefix(wfdm.getMetadata_output_file_prefix());
            parentPfjob.setOutputDir(wfdm.getMetadata_output_dir());
            if (workflowRunAccession != null && !workflowRunAccession.isEmpty()) {
              parentPfjob.setWorkflowRunAccession(workflowRunAccession);
            }
            // SEQWARE-1804 transfer setParentAccessions information ala Pegasus version in net.sourceforge.seqware.pipeline.workflowV2.engine.pegasus.object.Adag 
              if (!file.getParentAccessions().isEmpty()) {
File
WorkflowApp.java
Developer's decision
Version 1
Kind of conflict
Comment
For statement
If statement
Method invocation
Variable
Chunk
Conflicting content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
<<<<<<< HEAD
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
=======
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 82);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
    }

    @Test
Solution content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
    }

    @Test
File
BasicDeciderTest.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        launchAndCaptureOutput(params);
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
<<<<<<< HEAD
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 42);
=======
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 34);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
    }
    
    @Test
Solution content
        launchAndCaptureOutput(params);
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 42);
    }
    
    @Test
File
BasicDeciderTest.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
<<<<<<< HEAD
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
=======
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 82);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
        // we expect to launch 3 times 
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getFinalChecks(), decider.getFinalChecks() == 3);
    }
Solution content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
        // we expect to launch 3 times 
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getFinalChecks(), decider.getFinalChecks() == 3);
    }
File
BasicDeciderTest.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
<<<<<<< HEAD
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
=======
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 82);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
        // we expect to launch 3 times 
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getFinalChecks(), decider.getFinalChecks() == 80);
    }
Solution content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
        // we expect to launch 3 times 
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getFinalChecks(), decider.getFinalChecks() == 80);
    }
File
BasicDeciderTest.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
<<<<<<< HEAD
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
=======
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 82);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
        // we expect to never launch with the halting decider 
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 3);
        
Solution content
        // we expect to see 133 files in total
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
        // we expect to never launch with the halting decider 
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 3);
        
File
BasicDeciderTest.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
<<<<<<< HEAD
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
=======
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 82);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
        // we expect to launch exactly twice 
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 2);
        
Solution content
        // we need to override handleGroupByAttribute in order to count the number of expected files
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
        // we expect to launch exactly twice 
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 2);
        
File
BasicDeciderTest.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        launchAndCaptureOutput(params);
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
<<<<<<< HEAD
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 96);
=======
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 82);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 61);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
    }
    
    @Test
Solution content
        launchAndCaptureOutput(params);
        TestingDecider decider = (TestingDecider) instance;
        // we expect to see 133 files in total
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 133);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 61);
    }
    
    @Test
File
BasicDeciderTest.java
Developer's decision
Combination
Kind of conflict
Method invocation
Chunk
Conflicting content
        String[] params = {"--sample", "Sample_Tumour", "--wf-accession", "2860", "--meta-types", "application/bam,text/vcf-4,chemical/seq-na-fastq-gzip", "--test"};
        launchAndCaptureOutput(params);
        TestingDecider decider = (TestingDecider) instance;
<<<<<<< HEAD
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 39);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 20);
=======
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 17);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 12);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
    }
    
    
Solution content
        String[] params = {"--sample", "Sample_Tumour", "--wf-accession", "2860", "--meta-types", "application/bam,text/vcf-4,chemical/seq-na-fastq-gzip", "--test"};
        launchAndCaptureOutput(params);
        TestingDecider decider = (TestingDecider) instance;
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 39);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 12);
    }
    
    
File
BasicDeciderTest.java
Developer's decision
Combination
Kind of conflict
Method invocation
Chunk
Conflicting content
        // see "select sh.*, s.* FROM sample_hierarchy sh , (select DISTINCT s.sample_id from workflow_run wr, ius_workflow_runs iwr, ius, sample s WHERE status = 'pending' AND wr.workflow_run_id=iwr.workflow_run_id AND iwr.ius_id=ius.ius_id AND ius.sample_id=s.sample_id) sq, sample s WHERE sh.sample_id=sq.sample_id AND s.sample_id=sh.parent_id;"
        String[] params = new String[]{"--sample", "", "--wf-accession", "4773", "--meta-types", "application/bam,text/vcf-4,chemical/seq-na-fastq-gzip", "--rerun-max", "10", "--test"};
        launchAndCaptureOutput(params);
<<<<<<< HEAD
        TestingDecider decider = (TestingDecider) instance;
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 68);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 57);
=======
        decider = (TestingDecider) instance;
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 47);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 36);
>>>>>>> c6d3e18b6ad7b6ee91e27dc3123e9ecbbb30ecaf
        
        params = new String[]{"--sample", "", "--wf-accession", "4773", "--meta-types", "application/bam,text/vcf-4,chemical/seq-na-fastq-gzip", "--rerun-max", "1", "--test"};
        launchAndCaptureOutput(params);
Solution content
        // see "select sh.*, s.* FROM sample_hierarchy sh , (select DISTINCT s.sample_id from workflow_run wr, ius_workflow_runs iwr, ius, sample s WHERE status = 'pending' AND wr.workflow_run_id=iwr.workflow_run_id AND iwr.ius_id=ius.ius_id AND ius.sample_id=s.sample_id) sq, sample s WHERE sh.sample_id=sq.sample_id AND s.sample_id=sh.parent_id;"
        String[] params = new String[]{"--sample", "", "--wf-accession", "4773", "--meta-types", "application/bam,text/vcf-4,chemical/seq-na-fastq-gzip", "--rerun-max", "10", "--test"};
        launchAndCaptureOutput(params);
        TestingDecider decider = (TestingDecider) instance;
        Assert.assertTrue("output does not contain the correct number of files, we saw " + decider.getFileCount(), decider.getFileCount() == 47);
        Assert.assertTrue("output does not contain the correct number of launches, we saw " + decider.getLaunches(), decider.getLaunches() == 36);
        
        params = new String[]{"--sample", "", "--wf-accession", "4773", "--meta-types", "application/bam,text/vcf-4,chemical/seq-na-fastq-gzip", "--rerun-max", "1", "--test"};
        launchAndCaptureOutput(params);
File
BasicDeciderTest.java
Developer's decision
Combination
Kind of conflict
Cast expression
Method invocation
Variable