Last change
on this file since 242 was
242,
checked in by garonne, 18 years ago
|
enhance severals things
|
-
Property svn:executable set to
*
|
File size:
1.8 KB
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | #----------------------------------# |
---|
3 | # -- Author: V. Garonne |
---|
4 | # -- Mail: garonne@lal.in2p3.fr |
---|
5 | # -- Date: 08/25/2006 |
---|
6 | # -- Name: tbroadcast |
---|
7 | # -- Description: main program |
---|
8 | #----------------------------------# |
---|
9 | |
---|
10 | import os |
---|
11 | import sys |
---|
12 | import string |
---|
13 | |
---|
14 | from tbroadcast import Scheduler |
---|
15 | |
---|
16 | def usage(): |
---|
17 | print 'Usage : > tbroadcast [global options] [<command>]' |
---|
18 | print '# command :' |
---|
19 | print '# <command>: command to execute' |
---|
20 | print '# global options :' |
---|
21 | print '# -nb=<num_worker>] : Total number of threads' |
---|
22 | print '# -test : Simulate execution' |
---|
23 | print '# -check : Check execution (deadlocks)' |
---|
24 | print '# -print : Print dependency graph' |
---|
25 | print '# -help] : Print help' |
---|
26 | |
---|
27 | if __name__ == '__main__': |
---|
28 | # Default options |
---|
29 | num_worker = 20 |
---|
30 | command = '' |
---|
31 | test = False |
---|
32 | check = False |
---|
33 | print_graph = False |
---|
34 | for arg in sys.argv[1:len(sys.argv)]: |
---|
35 | if arg[0]=='-': |
---|
36 | option = string.split(arg,'=')[0] |
---|
37 | if option == '-nb': |
---|
38 | num_worker = int (string.split(arg,'=')[1]) |
---|
39 | elif option == '-test': |
---|
40 | test = True |
---|
41 | elif option == '-check': |
---|
42 | check = True |
---|
43 | elif option == '-print': |
---|
44 | print_graph = True |
---|
45 | else: |
---|
46 | usage() |
---|
47 | sys.exit(-1) |
---|
48 | else: |
---|
49 | command = arg |
---|
50 | |
---|
51 | master = Scheduler (num_workers=num_worker) |
---|
52 | if test: |
---|
53 | master.simulate_execution() |
---|
54 | elif check: |
---|
55 | master.check_execution (package=master.get_current_package()) |
---|
56 | elif print_graph: |
---|
57 | master.print_dependencies () |
---|
58 | else: |
---|
59 | master.execute_all (command) |
---|
60 | sys.exit(-1); |
---|
61 | #--------- EoF --------# |
---|
Note: See
TracBrowser
for help on using the repository browser.