~graphite-dev/graphite/1.1

« back to all changes in this revision

Viewing changes to whisper/bin/whisper-update.py

  • Committer: Chris Davis
  • Date: 2011-08-08 03:32:25 UTC
  • mfrom: (337.5.115 trunk)
  • Revision ID: chrismd@gmail.com-20110808033225-oncjaxk2pvd6651m
cherrypicking trunk revs 450-460

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
2
 
3
 
import sys, os, time
 
3
import sys, time
4
4
import whisper
5
5
from optparse import OptionParser
6
6
 
7
7
now = int( time.time() )
8
8
 
9
 
option_parser = OptionParser(usage='''%prog [options] path timestamp:value [timestamp:value]*''')
 
9
option_parser = OptionParser(
 
10
    usage='''%prog [options] path timestamp:value [timestamp:value]*''')
10
11
 
11
12
(options, args) = option_parser.parse_args()
12
13
 
16
17
 
17
18
path = args[0]
18
19
datapoint_strings = args[1:]
19
 
datapoint_strings = [point.replace('N:', '%d:' % now) for point in datapoint_strings]
 
20
datapoint_strings = [point.replace('N:', '%d:' % now)
 
21
                     for point in datapoint_strings]
20
22
datapoints = [tuple(point.split(':')) for point in datapoint_strings]
21
23
 
22
24
if len(datapoints) == 1: