Exemple #1
0
    def testGetPIDStatus(self):
        """Test that ToilStatus.getPIDStatus() behaves as expected."""
        jobstoreName = 'pidStatusTest'
        jobstoreLoc = os.path.join(os.getcwd(), jobstoreName)

        cmd = [
            'python', '-m', 'toil.test.sort.sort', 'file:' + jobstoreName,
            '--clean', 'never'
        ]
        wf = subprocess.Popen(cmd)
        time.sleep(
            2)  # Need to let jobstore be created before checking its contents.
        self.assertEqual(ToilStatus.getPIDStatus(jobstoreLoc), 'RUNNING')
        wf.wait()
        self.assertEqual(ToilStatus.getPIDStatus(jobstoreLoc), 'COMPLETED')
        os.remove(os.path.join(jobstoreLoc, 'pid.log'))
        self.assertEqual(ToilStatus.getPIDStatus(jobstoreLoc), 'QUEUED')
        shutil.rmtree(jobstoreLoc)
Exemple #2
0
    def testGetPIDStatus(self):
        """Test that ToilStatus.getPIDStatus() behaves as expected."""
        cmd = [
            'python', '-m', 'toil.test.sort.sort', 'file:' + self.toilDir,
            '--clean', 'never'
        ]
        wf = subprocess.Popen(cmd)
        time.sleep(
            2)  # Need to let jobstore be created before checking its contents.
        self.assertEqual('RUNNING', ToilStatus.getPIDStatus(self.toilDir))
        wf.wait()
        self.assertEqual('COMPLETED', ToilStatus.getPIDStatus(self.toilDir))
        os.remove(os.path.join(self.toilDir, 'pid.log'))
        self.assertEqual('QUEUED', ToilStatus.getPIDStatus(self.toilDir))

        for f in ['fileToSort.txt',
                  'sortedFile.txt']:  # This toil WF does not clean these up.
            if os.path.exists(f):
                os.remove(f)