1 |
Author: zmedico |
2 |
Date: 2009-04-30 06:53:14 +0000 (Thu, 30 Apr 2009) |
3 |
New Revision: 13442 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.6/bin/egencache |
7 |
Log: |
8 |
Add parsing code for --jobs and --load-average. (trunk r13263) |
9 |
|
10 |
Modified: main/branches/2.1.6/bin/egencache |
11 |
=================================================================== |
12 |
--- main/branches/2.1.6/bin/egencache 2009-04-30 06:53:00 UTC (rev 13441) |
13 |
+++ main/branches/2.1.6/bin/egencache 2009-04-30 06:53:14 UTC (rev 13442) |
14 |
@@ -56,6 +56,37 @@ |
15 |
parser.error('No action specified (--update ' + \ |
16 |
'is the only available action)') |
17 |
|
18 |
+ if options.jobs: |
19 |
+ jobs = None |
20 |
+ try: |
21 |
+ jobs = int(options.jobs) |
22 |
+ except ValueError: |
23 |
+ jobs = -1 |
24 |
+ |
25 |
+ if jobs < 1: |
26 |
+ parser.error("Invalid: --jobs='%s'" % \ |
27 |
+ (options.jobs,)) |
28 |
+ |
29 |
+ options.jobs = jobs |
30 |
+ |
31 |
+ else: |
32 |
+ options.jobs = None |
33 |
+ |
34 |
+ if options.load_average: |
35 |
+ try: |
36 |
+ load_average = float(options.load_average) |
37 |
+ except ValueError: |
38 |
+ load_average = 0.0 |
39 |
+ |
40 |
+ if load_average <= 0.0: |
41 |
+ parser.error("Invalid: --load-average='%s'" % \ |
42 |
+ (options.load_average,)) |
43 |
+ |
44 |
+ options.load_average = load_average |
45 |
+ |
46 |
+ else: |
47 |
+ options.load_average = None |
48 |
+ |
49 |
if options.config_root is not None and \ |
50 |
not os.path.isdir(options.config_root): |
51 |
parser.error("Not a directory: --config-root='%s'" % \ |