Revision 798
Added by Borja Sotomayor almost 14 years ago
commands.py | ||
---|---|---|
25 | 25 |
from haizea.cli.optionparser import Option |
26 | 26 |
from haizea.cli import Command |
27 | 27 |
from haizea.lwf.generators import LWFGenerator, LWFAnnotationGenerator |
28 |
from haizea.lwf.analysis import LWFAnalyser |
|
28 | 29 |
from mx.DateTime import TimeDelta, Parser |
29 | 30 |
import haizea.common.defaults as defaults |
30 | 31 |
import sys |
... | ... | |
367 | 368 |
self.optparser.add_option(Option("-c", "--conf", action="store", type="string", dest="conf", |
368 | 369 |
help = """ |
369 | 370 |
... |
370 |
""")) |
|
371 |
"""))
|
|
371 | 372 |
|
372 | 373 |
def run(self): |
373 | 374 |
self.parse_options() |
... | ... | |
379 | 380 |
|
380 | 381 |
generator.generate() |
381 | 382 |
|
383 |
class haizea_lwf_stats(Command): |
|
384 |
|
|
385 |
name = "haizea-lwf-stats" |
|
386 |
|
|
387 |
def __init__(self, argv): |
|
388 |
Command.__init__(self, argv) |
|
389 |
self.optparser.add_option(Option("-i", "--in", action="store", type="string", dest="inf", required=True, |
|
390 |
help = """ |
|
391 |
Input file |
|
392 |
""")) |
|
393 |
self.optparser.add_option(Option("-l", "--utilization-length", action="store", type="string", dest="utilization_length", |
|
394 |
help = """ |
|
395 |
Length of the utilization interval in format DD:HH:MM:SS. Default is until |
|
396 |
the time the last lease is requested. |
|
397 |
""")) |
|
398 |
|
|
399 |
def run(self): |
|
400 |
self.parse_options() |
|
401 |
|
|
402 |
infile = self.opt.inf |
|
403 |
utilization_length = self.opt.utilization_length |
|
404 |
if utilization_length != None: |
|
405 |
utilization_length = Parser.DateTimeDeltaFromString(utilization_length) |
|
406 |
|
|
407 |
analyser = LWFAnalyser(infile, utilization_length) |
|
408 |
|
|
409 |
analyser.analyse() |
|
410 |
|
|
382 | 411 |
class haizea_lwf_annotate(Command): |
383 | 412 |
|
384 | 413 |
name = "haizea-lwf-annotate" |
Also available in: Unified diff
Utilization-based LWF generation (still needs some work, but mostly done)