Rev | Line | |
---|
[976] | 1 |
|
---|
| 2 | import time
|
---|
| 3 | import pytz
|
---|
| 4 |
|
---|
| 5 | from backup_monitoring.parsing.parsers import bpdbjobs as parser
|
---|
| 6 |
|
---|
| 7 | file = open('test.txt', 'r')
|
---|
| 8 |
|
---|
| 9 | stream = parser.stream(file)
|
---|
| 10 |
|
---|
| 11 | i = 0
|
---|
| 12 |
|
---|
| 13 | tz = pytz.timezone('CET')
|
---|
| 14 |
|
---|
| 15 | for record in stream:
|
---|
| 16 |
|
---|
| 17 | i += 1
|
---|
| 18 |
|
---|
| 19 | job = parser.parse(record, tz=tz)
|
---|
| 20 |
|
---|
| 21 | jobid = job.jobid
|
---|
| 22 | jobtype = job.jobtype
|
---|
| 23 | state = job.state
|
---|
| 24 | started = job.started
|
---|
| 25 | stunit = job.stunit
|
---|
| 26 |
|
---|
| 27 | if jobtype == 'backup' and jobid == 218840:
|
---|
| 28 |
|
---|
| 29 | print 'jobid=%d, started=%s' % (jobid, started)
|
---|
| 30 |
|
---|
| 31 | time.sleep(1)
|
---|
| 32 |
|
---|
| 33 | file.close()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.