Example #1
0
    def makeRunnable(self, tempDir):
        from toil.common import toilPackageDirPath

        pickleFile = tempDir.getTempFile(".pickle")
        fileHandle = open(pickleFile, 'w')
        cPickle.dump(self, fileHandle, cPickle.HIGHEST_PROTOCOL)
        fileHandle.close() 
        multijobexec = os.path.join(toilPackageDirPath(), "bin", "multijob")
        jtPath = os.path.split(toilPackageDirPath())[0]
        return "%s %s %s" % (multijobexec, pickleFile, jtPath)
Example #2
0
    def makeRunnable(self, tempDir):
        from toil.common import toilPackageDirPath

        pickleFile = tempDir.getTempFile(".pickle")
        fileHandle = open(pickleFile, 'w')
        cPickle.dump(self, fileHandle, cPickle.HIGHEST_PROTOCOL)
        fileHandle.close()
        multijobexec = os.path.join(toilPackageDirPath(), "bin", "multijob")
        jtPath = os.path.split(toilPackageDirPath())[0]
        return "%s %s %s" % (multijobexec, pickleFile, jtPath)
Example #3
0
    def testUtilsStatsSort(self):
        """
        Tests the stats commands on a complete run of the stats test.
        """
        # Get the sort command to run
        toilCommandString = ("{self.sort} "
                             "{self.toilDir} "
                             "--logLevel=DEBUG "
                             "--fileToSort={self.tempFile} "
                             "--N {self.N} --stats "
                             "--retryCount 99".format(**locals()))

        # Run the script for the first time
        system(toilCommandString)
        self.assertTrue(os.path.exists(self.toilDir))

        # Check we can run 'toil stats'
        rootPath = os.path.join(toilPackageDirPath(), "utils")
        toilStatsString = ("{self.toilMain} stats "
                           "{self.toilDir} --pretty".format(**locals()))
        system(toilStatsString)

        # Check the file is properly sorted
        with open(self.tempFile, 'r') as fileHandle:
            l2 = fileHandle.readlines()
            self.assertEquals(self.correctSort, l2)
Example #4
0
 def testToilStats_SortSimple(self):
     """
     Tests the toilStats utility using the scriptTree_sort example.
     """
     for test in xrange(self.testNo):
         tempDir = getTempDirectory(os.getcwd())
         tempFile = getTempFile(rootDir=tempDir)
         outputFile = getTempFile(rootDir=tempDir)
         toilDir = os.path.join(tempDir, "testToil")
         lines = 10000
         maxLineLength = 10
         N = 1000
         makeFileToSort(tempFile, lines, maxLineLength)
         # Sort the file
         rootPath = os.path.join(toilPackageDirPath(), "test", "sort")
         system("{rootPath}/sort.py "
                "--toil {toilDir} "
                "--logLevel=DEBUG "
                "--fileToSort={tempFile} "
                "--N {N} --stats "
                "--jobTime 0.5 "
                "--retryCount 99".format(**locals()))
         # Now get the stats
         toilStats = self.getScriptPath('toilStats')
         system("{toilStats} "
                "--toil {toilDir} "
                "--outputFile {outputFile}".format(**locals()))
         # Cleanup
         system("rm -rf %s" % tempDir)
Example #5
0
 def __init__(self, config, batchSystem, jobStore, toilState):
     self.config = config
     self.jobStore = jobStore
     self.jobStoreString = config.jobStore
     self.toilState = toilState
     self.jobBatchSystemIDToJobStoreIDHash = {}
     self.batchSystem = batchSystem
     self.jobsIssued = 0
     self.workerPath = os.path.join(toilPackageDirPath(), "worker.py")
     self.reissueMissingJobs_missingHash = {} #Hash to store number of observed misses
Example #6
0
 def __init__(self, config, batchSystem, jobStore, toilState):
     self.config = config
     self.jobStore = jobStore
     self.jobStoreString = config.jobStore
     self.toilState = toilState
     self.jobBatchSystemIDToJobStoreIDHash = {}
     self.batchSystem = batchSystem
     self.jobsIssued = 0
     self.workerPath = os.path.join(toilPackageDirPath(), "worker.py")
     self.reissueMissingJobs_missingHash = {
     }  #Hash to store number of observed misses
Example #7
0
 def _getUtilScriptPath(cls, script_name):
     return os.path.join(toilPackageDirPath(), 'utils', script_name + '.py')
Example #8
0
 def sort(self):
     return os.path.join(toilPackageDirPath(), "test", "sort", "sort.py")
Example #9
0
 def getScriptPath(self, script_name):
     return os.path.join(toilPackageDirPath(), 'utils', script_name + '.py')
Example #10
0
 def _getUtilScriptPath(cls, script_name):
     return os.path.join(toilPackageDirPath(), 'utils', script_name + '.py')