Skip to content

Commit cc67051

Browse files
authored
Merge pull request #199 from nnDarshan/patch-5
Span the hardware inventory collection over a period of time.
2 parents 8c8ccf0 + 7093c5b commit cc67051

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

tendrl/node_agent/manager/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def load_and_execute_sds_discovery_plugins(self):
7979

8080
def main():
8181
tendrl_ns.central_store_thread = central_store.NodeAgentEtcdCentralStore()
82+
tendrl_ns.first_node_inventory_sync = True
8283
tendrl_ns.state_sync_thread = node_sync.NodeAgentSyncThread()
8384

8485
tendrl_ns.node_context.save()

tendrl/node_agent/node_sync/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ def _run(self):
4040

4141
while not self._complete.is_set():
4242
try:
43-
gevent.sleep(3)
43+
interval = 10
44+
if tendrl_ns.first_node_inventory_sync:
45+
interval = 2
46+
tendrl_ns.first_node_inventory_sync = False
47+
48+
gevent.sleep(interval)
4449
tags = []
4550
# update node agent service details
4651
LOG.info("node_sync, Updating Service data")
@@ -49,20 +54,25 @@ def _run(self):
4954
if s.running:
5055
tags.append(TENDRL_SERVICE_TAGS[service.strip("@*")])
5156
s.save()
57+
gevent.sleep(interval)
5258

5359
# updating node context with latest tags
5460
LOG.info("node_sync, updating node context data with tags")
5561
tags = "\n".join(tags)
5662
tendrl_ns.node_agent.objects.NodeContext(tags=tags).save()
63+
gevent.sleep(interval)
5764

5865
LOG.info("node_sync, Updating OS data")
5966
tendrl_ns.node_agent.objects.Os().save()
67+
gevent.sleep(interval)
6068

6169
LOG.info("node_sync, Updating cpu")
6270
tendrl_ns.node_agent.objects.Cpu().save()
71+
gevent.sleep(interval)
6372

6473
LOG.info("node_sync, Updating memory")
6574
tendrl_ns.node_agent.objects.Memory().save()
75+
gevent.sleep(interval)
6676

6777
LOG.info("node_sync, Updating disks")
6878
try:

0 commit comments

Comments
 (0)