Mercurial > repos > yufei-luo > s_mart
diff commons/core/launcher/test/expFiles/expJobScriptTemplateLight.py @ 6:769e306b7933
Change the repository level.
author | yufei-luo |
---|---|
date | Fri, 18 Jan 2013 04:54:14 -0500 |
parents | |
children | 94ab73e8a190 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/commons/core/launcher/test/expFiles/expJobScriptTemplateLight.py Fri Jan 18 04:54:14 2013 -0500 @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import os +import sys +import time +import shutil +from commons.core.checker.RepetException import RepetException +try: + newDir = None + print os.uname() + beginTime = time.time() + print 'beginTime=%f' % beginTime + print "work in dir '/home/user/workspace/repet_pipe/commons/core/launcher/test/dummyScratch'" + sys.stdout.flush() + if not os.path.exists( "/home/user/workspace/repet_pipe/commons/core/launcher/test/dummyScratch" ): + raise IOError("ERROR: temporary directory '/home/user/workspace/repet_pipe/commons/core/launcher/test/dummyScratch' doesn't exist") + + minFreeGigaInTmpDir = 1 + freeSpace = os.statvfs("/home/user/workspace/repet_pipe/commons/core/launcher/test/dummyScratch") + if ((freeSpace.f_bavail * freeSpace.f_frsize) / 1073741824.0 < minFreeGigaInTmpDir): + raise RepetException("ERROR: less than %iG of input file in '/home/user/workspace/repet_pipe/commons/core/launcher/test/dummyScratch'" % minFreeGigaInTmpDir) + + os.chdir("/home/user/workspace/repet_pipe/commons/core/launcher/test/dummyScratch") + newDir = "groupid_job1_20110505-105353" + if os.path.exists(newDir): + shutil.rmtree(newDir) + os.mkdir(newDir) + os.chdir(newDir) + + log = os.system("touch dummyFile1") + if log != 0: + raise RepetException("ERROR: job returned %i" % log) + else: + print "job finished successfully" + sys.stdout.flush() + shutil.move("dummyFile1", "/home/user/workspace/repet_pipe/commons/core/launcher/test") + + os.chdir("..") + shutil.rmtree(newDir) + endTime = time.time() + print 'endTime=%f' % endTime + print 'executionTime=%f' % (endTime - beginTime) + print os.uname() + sys.stdout.flush() + +except IOError, e : + print e + sys.stdout.flush() + sys.exit(1) \ No newline at end of file