-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCrabLooper.py
More file actions
23 lines (18 loc) · 842 Bytes
/
CrabLooper.py
File metadata and controls
23 lines (18 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import commands as cmd
import sys
import time
if len(sys.argv) < 2:
raise Exception("You need to give a command and a folder to Crab Looper. Usage: python CrabLooper.py Directory CarbAction")
CrabFolder = sys.argv[1]
CrabAction = sys.argv[2]
ITime=time.localtime()
StringITime=str(ITime.tm_year)+'_'+str(ITime.tm_mon)+'_'+str(ITime.tm_mday)+'_'+str(ITime.tm_hour)+'_'+str(ITime.tm_min)
print "Starting Crab Looper! at "+StringITime
ListOfFolders=cmd.getoutput('ls '+CrabFolder)
ListOfFolders=ListOfFolders.split('\n')
for i in ListOfFolders:
if 'crab' not in i: continue
print 'Executing action over: '+i
CrabOutput = cmd.getoutput('crab '+CrabAction+' -d '+CrabFolder+'/'+i)
print CrabOutput
print '---------------------------------------------------------------------------------------------------------------'