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