/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Mdc/DedxCalibAlg/DedxCalibAlg-00-01-15/share/sub/separate_jobs.py

Go to the documentation of this file.
00001 #!/bes/besd09/zhuk/local/bin/python3.1
00002 #!/usr/bin/python
00003 # this program is used to separate jobs in one job.txt file
00004 import os, string, sys, math, time
00005 if(len(sys.argv)<2):
00006     print("example: separate_jobs.py 10")
00007     sys.exit()
00008 else:
00009     num = int(sys.argv[1])
00010 
00011 count = 0
00012 tag = 0
00013 jobfile = open("job.txt", "r")
00014 for line in jobfile:
00015     count += 1
00016     if count == 1:
00017         tag += 1
00018         subjob = open("subjob_" + str(tag) + ".sh", "w")
00019     subjob.write(line)
00020     if count == num:
00021         count = 0
00022         subjob.close()
00023         os.system("chmod u+x subjob_" + str(tag) + ".sh")
00024 subjob.close()
00025 os.system("chmod u+x subjob_" + str(tag) + ".sh")

Generated on Tue Nov 29 23:12:45 2016 for BOSS_7.0.2 by  doxygen 1.4.7