source: tbroadcast/HEAD/scripts/tbroadcast @ 248

Last change on this file since 248 was 248, checked in by garonne, 18 years ago

Mise au propre option + script generateGantt

  • Property svn:executable set to *
File size: 3.4 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
10import os
11import sys
12import string
13
14from tbroadcast import Scheduler
15
16def usage():
17    print 'Usage : > tbroadcast [global options] [<command>]'
18    print '# command :'
19    print '#   <command>: command to execute'
20    print '# global options :'
21    print '#   -f=<file>             : Input file'
22    print '#   -help                 : Print help'
23    print '#   -local                : Reach packages only within the current project'
24    print '#   -global               : Reach packages in all CMTPATH/CMTPROJECTPATH items'   
25    print '#   -ignore_cycles        : Suppress automatically the cycles'
26    print '#   -nb=<num_worker>      : Change the total number of threads[default is 20]'
27    print '#   -output=<location>    : Output directory to store output files with the form <package>_output.log'
28    print '#   -error=<location>     : Output directory to store error output with the form <package>_error.log'
29    print '#   -perf=<file>          : Store for each package the time for executing the command in the <file> file'
30    print '#   -print                : Print dependencies for each package' 
31    print '#   -silent               : Disable print'     
32    print '#   -test                 : Simulate execution'
33
34if __name__ == '__main__':
35    # Default options
36    num_worker    = 20
37    command       = ''
38    test          = False
39    check         = False
40    print_graph   = False
41    local         = False
42    ignore_cycles = False
43    silent        = False
44    perf          = False     
45    output        = None
46    error         = None
47    file          = None
48    for arg in sys.argv[1:len(sys.argv)]:           
49         if arg[0]=='-':
50             option = string.split(arg,'=')[0]
51             if option == '-nb':
52                num_worker = int (string.split(arg,'=')[1]) 
53             if option == '-f':
54                file = string.split(arg,'=')[1]
55             if option == '-perf':
56                perf = string.split(arg,'=')[1]
57             if option == '-output':
58                output = string.split(arg,'=')[1]
59             if option == '-error':
60                error = string.split(arg,'=')[1]
61             if option == '-local':
62                 local= True
63             if option == '-ignore_cycles':             
64                 ignore_cycles = True
65             if option == '-silent':             
66                 silent = True                 
67             if option == '-help':   
68                  usage()
69                  sys.exit(-1)     
70                             
71             if option == '-test':
72                     test = True   
73             elif option == '-check':
74                     check = True   
75             elif option == '-print':
76                     print_graph = True   
77         else:
78              command = arg
79
80    master = Scheduler (num_workers=num_worker, file=file, ignore_cycles=ignore_cycles, local=local, output=output, error=error, silent=silent, perf=perf)
81    if test:
82        master.simulate_execution()
83    elif check:
84        master.check_execution (package=master.get_current_package())   
85    elif print_graph:
86        master.print_dependencies ()
87    else:
88        master.execute_all (command)
89    sys.exit(-1);
90#--------- EoF --------#
Note: See TracBrowser for help on using the repository browser.