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