예제 #1
0
def main(args):
    import bisque.queuer as qr
    from bisque import persist
    from bisque.timing import timed

    assert len(args) == 2
    liveJobDir = args[1]
    liveJob = qr.LiveJob(liveJobDir)
    liveJob.setRunning()

    try:
        job = persist.loadPickle(os.path.join(liveJob.dir, 'job.pickle'))
        jobSecHash = liveJob.extra('secHash')
        # (FIXME : this should be trivially true now. Remove secHash extra entirely?)
        assert jobSecHash == job.secHash()
        buildRepo = persist.loadPickle(
            os.path.join(liveJob.dir, 'buildRepo.pickle'))
        print 'sge_runner: job', job.secHash(
        ), '(', job.name, ')', '(', liveJob.dir, ') started at', datetime.now(
        ), 'on', os.environ['HOSTNAME']
        print 'sge_runner: build dir =', buildRepo.base
        print 'sge_runner: inputs =', [
            inputArt.secHash() for inputArt in job.inputs
        ]
        job.checkAllSecHash()
        timed(job.run)(buildRepo)
        job.checkAllSecHash()
        print 'sge_runner: job', job.secHash(
        ), '(', job.name, ')', '(', liveJob.dir, ') finished at', datetime.now(
        ), 'on', os.environ['HOSTNAME']
    except:
        liveJob.setError()
        raise

    liveJob.setCompleted()
예제 #2
0
def main(args):
    import bisque.queuer as qr
    from bisque import persist
    from bisque.timing import timed

    assert len(args) == 2
    liveJobDir = args[1]
    liveJob = qr.LiveJob(liveJobDir)
    liveJob.setRunning()

    try:
        job = persist.loadPickle(os.path.join(liveJob.dir, 'job.pickle'))
        jobSecHash = liveJob.extra('secHash')
        # (FIXME : this should be trivially true now. Remove secHash extra entirely?)
        assert jobSecHash == job.secHash()
        buildRepo = persist.loadPickle(os.path.join(liveJob.dir, 'buildRepo.pickle'))
        print 'sge_runner: job', job.secHash(), '(', job.name, ')', '(', liveJob.dir, ') started at', datetime.now(), 'on', os.environ['HOSTNAME']
        print 'sge_runner: build dir =', buildRepo.base
        print 'sge_runner: inputs =', [ inputArt.secHash() for inputArt in job.inputs ]
        job.checkAllSecHash()
        timed(job.run)(buildRepo)
        job.checkAllSecHash()
        print 'sge_runner: job', job.secHash(), '(', job.name, ')', '(', liveJob.dir, ') finished at', datetime.now(), 'on', os.environ['HOSTNAME']
    except:
        liveJob.setError()
        raise

    liveJob.setCompleted()
예제 #3
0
 def test_pickling(self):
     l = [1, 2, 3]
     d = dict()
     d['a'] = l
     d['b'] = l
     with TempDir() as tempDir:
         def loc(suffix):
             return os.path.join(tempDir.location, suffix)
         location1 = loc('d1.pickle')
         location2 = loc('d2.pickle')
         persist.savePickle(location1, d)
         persist.savePickle(location2, d)
         dAgain1 = persist.loadPickle(location1)
         dAgain2 = persist.loadPickle(location2)
         assert d == dAgain1 == dAgain2
예제 #4
0
    def createLiveJob(self, job, queuer):
        jobSecHash = job.secHash()
        jobQueuerDir = self.getJobQueuerDir(job, queuer)
        createDir(jobQueuerDir)
        liveJobDir = tempfile.mkdtemp(prefix = 'liveJob.', dir = jobQueuerDir)
        liveJob = LiveJob(liveJobDir)
        persist.savePickle(os.path.join(liveJob.dir, 'job.pickle'), job)
        liveJob.setExtra('secHash', jobSecHash)
        persist.savePickle(os.path.join(liveJob.dir, 'buildRepo.pickle'), self)
        liveJob.setStored()

        job.checkAllSecHash()
        assert self.getJobQueuerDir(job, queuer) == jobQueuerDir
        jobAgain = persist.loadPickle(os.path.join(liveJob.dir, 'job.pickle'))
        job.checkAllSecHash()

        return liveJob
예제 #5
0
 def loadValue(self, buildRepo):
     return persist.loadPickle(self.loc(buildRepo))
예제 #6
0
 def loadValue(self, buildRepo):
     return persist.loadPickle(self.loc(buildRepo))