Last change
on this file since 241 was
241,
checked in by garonne, 18 years ago
|
add semaphores
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Rev | Line | |
---|
[240] | 1 | #!/usr/bin/env python |
---|
[232] | 2 | #----------------------------------# |
---|
| 3 | # -- Author: V.Garonne |
---|
| 4 | # -- Date: 08/25/2006 |
---|
| 5 | # -- Name: tbroadcast |
---|
| 6 | # -- Description: main program |
---|
| 7 | #----------------------------------# |
---|
| 8 | |
---|
| 9 | import os |
---|
| 10 | import sys |
---|
[234] | 11 | import string |
---|
[232] | 12 | |
---|
| 13 | from tbroadcast import Scheduler |
---|
| 14 | |
---|
[240] | 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 | |
---|
[232] | 23 | if __name__ == '__main__': |
---|
[240] | 24 | # Default options |
---|
| 25 | num_worker = 20 |
---|
| 26 | command = '' |
---|
| 27 | for arg in sys.argv[1:len(sys.argv)]: |
---|
[232] | 28 | if arg[0]=='-': |
---|
[240] | 29 | option = string.split(arg,'=')[0] |
---|
| 30 | if option == '-nb': |
---|
[232] | 31 | num_worker = int (string.split(arg,'=')[1]) |
---|
[240] | 32 | else: |
---|
| 33 | usage() |
---|
| 34 | sys.exit(-1) |
---|
| 35 | |
---|
[232] | 36 | else: |
---|
| 37 | command = arg |
---|
[240] | 38 | |
---|
[241] | 39 | master = Scheduler (num_workers=num_worker) |
---|
[232] | 40 | master.execute_all (command) |
---|
| 41 | |
---|
| 42 | sys.exit(-1); |
---|
| 43 | #--------- EoF --------# |
---|
Note: See
TracBrowser
for help on using the repository browser.