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)
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)
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)
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
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
def _getUtilScriptPath(cls, script_name): return os.path.join(toilPackageDirPath(), 'utils', script_name + '.py')
def sort(self): return os.path.join(toilPackageDirPath(), "test", "sort", "sort.py")
def getScriptPath(self, script_name): return os.path.join(toilPackageDirPath(), 'utils', script_name + '.py')