Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18637485
Puppet DB API ordering
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
Krenair
May 31 2018, 7:58 PM
2018-05-31 19:58:14 (UTC+0)
Size
1020 B
Referenced Files
None
Subscribers
None
Puppet DB API ordering
View Options
>>> import requests, time
>>> get_data = lambda: requests.get('https://deployment-puppetdb02.deployment-prep.eqiad.wmflabs/pdb/query/v4/resources?query=[%22and%22,[%22=%22,%22type%22,%22Sshkey%22],[%22~%22,%22title%22,%22.*%22],[%22=%22,%22exported%22,true]]').json()
>>> initial_data = get_data()
>>> sorted_initial_data = sorted(initial_data, key=lambda d: str(d))
>>> initial_time = time.time()
>>> print('got data at {}'.format(initial_time))
got data at 1527796647.7953048
>>> while True:
... new_data = get_data()
... new_time = time.time()
... sorted_new_data = sorted(new_data, key=lambda d: str(d))
... if new_data != initial_data:
... print('it changed at {}!'.format(new_time))
... print('diff: {}'.format(new_time - initial_time))
... print('If sorted, would it be the same? {}'.format(sorted_new_data == sorted_initial_data))
... break
... time.sleep(5)
...
it changed at 1527796663.8514915!
diff: 16.05618667602539
If sorted, would it be the same? True
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5857774
Default Alt Text
Puppet DB API ordering (1020 B)
Attached To
Mode
P7199 Puppet DB API ordering
Attached
Detach File
Event Timeline
Log In to Comment