Skip to content

Commit

Permalink
Merge pull request #199 from nnDarshan/patch-5
Browse files Browse the repository at this point in the history
Span the hardware inventory collection over a period of time.
  • Loading branch information
r0h4n authored Feb 2, 2017
2 parents 8c8ccf0 + 7093c5b commit cc67051
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions tendrl/node_agent/manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def load_and_execute_sds_discovery_plugins(self):

def main():
tendrl_ns.central_store_thread = central_store.NodeAgentEtcdCentralStore()
tendrl_ns.first_node_inventory_sync = True
tendrl_ns.state_sync_thread = node_sync.NodeAgentSyncThread()

tendrl_ns.node_context.save()
Expand Down
12 changes: 11 additions & 1 deletion tendrl/node_agent/node_sync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def _run(self):

while not self._complete.is_set():
try:
gevent.sleep(3)
interval = 10
if tendrl_ns.first_node_inventory_sync:
interval = 2
tendrl_ns.first_node_inventory_sync = False

gevent.sleep(interval)
tags = []
# update node agent service details
LOG.info("node_sync, Updating Service data")
Expand All @@ -49,20 +54,25 @@ def _run(self):
if s.running:
tags.append(TENDRL_SERVICE_TAGS[service.strip("@*")])
s.save()
gevent.sleep(interval)

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

LOG.info("node_sync, Updating OS data")
tendrl_ns.node_agent.objects.Os().save()
gevent.sleep(interval)

LOG.info("node_sync, Updating cpu")
tendrl_ns.node_agent.objects.Cpu().save()
gevent.sleep(interval)

LOG.info("node_sync, Updating memory")
tendrl_ns.node_agent.objects.Memory().save()
gevent.sleep(interval)

LOG.info("node_sync, Updating disks")
try:
Expand Down

0 comments on commit cc67051

Please sign in to comment.