Changeset 240 for tbroadcast/v2/scripts
- Timestamp:
- Aug 28, 2006, 1:20:02 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tbroadcast/v2/scripts/tbroadcast
r237 r240 1 #!/usr/bin/env python 21 #!/usr/bin/env python 2 2 #----------------------------------# 3 3 # -- Author: V.Garonne … … 13 13 from tbroadcast import Scheduler 14 14 15 def usage(): 16 print 'Usage : > tbroadcast [global options] [<command>]' 17 print '# command :' 18 print '# <command>: command to execute' 19 print '# global options :' 20 print '# -nb=<num_worker>] : Total number of threads' 21 print '# -help] : Print help' 22 15 23 if __name__ == '__main__': 16 17 if len(sys.argv) ==1 : 18 print 'Usage : > tbroadcast [-nb=<num_worker>] <command>' 19 sys.exit(-1) 20 num_worker = 20 21 for arg in sys.argv: 24 # Default options 25 num_worker = 20 26 command = '' 27 for arg in sys.argv[1:len(sys.argv)]: 22 28 if arg[0]=='-': 23 if string.split(arg,'=')[0] == '-nb': 29 option = string.split(arg,'=')[0] 30 if option == '-nb': 24 31 num_worker = int (string.split(arg,'=')[1]) 32 else: 33 usage() 34 sys.exit(-1) 35 25 36 else: 26 37 command = arg 27 28 # we create a pool of num_worker worker threads 29 #print 'num_worker', num_worker , command 38 30 39 master = Scheduler (num_workers=num_worker) 31 40 master.execute_all (command)
Note: See TracChangeset
for help on using the changeset viewer.