source: tbroadcast/HEAD/scripts/tbroadcast @ 252

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

Ajout affichage version

  • Property svn:executable set to *
File size: 3.6 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 '#   -version              : version of tbroadcast'       
32    print '#   -silent               : Disable print'     
33    print '#   -test                 : Simulate execution'
34
35if __name__ == '__main__':
36    # Default options
37    num_worker    = 20
38    command       = ''
39    version       = 'HEAD'
40    test          = False
41    check         = False
42    print_graph   = False
43    local         = False
44    ignore_cycles = False
45    silent        = False
46    perf          = False     
47    output        = None
48    error         = None
49    file          = None
50    for arg in sys.argv[1:len(sys.argv)]:           
51         if arg[0]=='-':
52             option = string.split(arg,'=')[0]
53             if option == '-version':
54                 print version
55                 sys.exit(-1)
56             if option == '-nb':
57                num_worker = int (string.split(arg,'=')[1]) 
58             if option == '-f':
59                file = string.split(arg,'=')[1]
60             if option == '-perf':
61                perf = string.split(arg,'=')[1]
62             if option == '-output':
63                output = string.split(arg,'=')[1]
64             if option == '-error':
65                error = string.split(arg,'=')[1]
66             if option == '-local':
67                 local= True
68             if option == '-ignore_cycles':             
69                 ignore_cycles = True
70             if option == '-silent':             
71                 silent = True                 
72             if option == '-help':   
73                  usage()
74                  sys.exit(-1)     
75                             
76             if option == '-test':
77                     test = True   
78             elif option == '-check':
79                     check = True   
80             elif option == '-print':
81                     print_graph = True   
82         else:
83              command = arg
84
85    master = Scheduler (num_workers=num_worker, file=file, ignore_cycles=ignore_cycles, local=local, output=output, error=error, silent=silent, perf=perf)
86    if test:
87        master.simulate_execution()
88    elif check:
89        master.check_execution (package=master.get_current_package())   
90    elif print_graph:
91        master.print_dependencies ()
92    else:
93        master.execute_all (command)
94    sys.exit(-1);
95#--------- EoF --------#
Note: See TracBrowser for help on using the repository browser.