source: trunk/misc/operations_helpers/cpu-watcher-poll.py

Last change on this file was b856238, checked in by Alexandre Detiste <alexandre.detiste@…>, at 2024-02-15T15:53:34Z

remove old Python2 future statements

  • Property mode set to 100644
File size: 493 bytes
Line 
1#!/usr/bin/env python
2
3
4from foolscap import Tub, eventual
5from twisted.internet import reactor
6import sys
7import pprint
8
9def oops(f):
10    print("ERROR")
11    print(f)
12
13def fetch(furl):
14    t = Tub()
15    t.startService()
16    d = t.getReference(furl)
17    d.addCallback(lambda rref: rref.callRemote("get_averages"))
18    d.addCallback(pprint.pprint)
19    return d
20
21d = eventual.fireEventually(sys.argv[1])
22d.addCallback(fetch)
23d.addErrback(oops)
24d.addBoth(lambda res: reactor.stop())
25reactor.run()
Note: See TracBrowser for help on using the repository browser.