Commit 939496ce authored by Valentin Reis's avatar Valentin Reis

[feature] added upstream publishing of performance counters.

This includes renaming "progress" to performance in argo_perf_wrapper.
There are two distincts keywords in the messaging layer: "performance"
for all things related to hardware, and "progress", for all things
relating to the application.
parent 388295f2
Pipeline #4823 passed with stages
in 2 minutes and 32 seconds
...@@ -30,12 +30,14 @@ class PerfWrapper(object): ...@@ -30,12 +30,14 @@ class PerfWrapper(object):
msg = PUB_MSG['application_exit'](**update) msg = PUB_MSG['application_exit'](**update)
self.downstream_event.sendmsg(msg) self.downstream_event.sendmsg(msg)
def progress_report(self, progress): def performance_report(self, performance):
update = {'api': 'down_event', update = {'api': 'down_event',
'type': 'progress', 'type': 'performance',
'payload': progress, 'payload': performance,
'container_uuid' : self.container_uuid,
'application_uuid' : self.app_uuid,
} }
msg = PUB_MSG['progress'](**update) msg = PUB_MSG['performance'](**update)
self.downstream_event.sendmsg(msg) self.downstream_event.sendmsg(msg)
def setup(self): def setup(self):
...@@ -123,7 +125,7 @@ class PerfWrapper(object): ...@@ -123,7 +125,7 @@ class PerfWrapper(object):
ips = int(instructions / (time - last_time)) ips = int(instructions / (time - last_time))
logger.info("instructions per second: %r", ips) logger.info("instructions per second: %r", ips)
self.progress_report(ips) self.performance_report(ips)
last_time = time last_time = time
......
...@@ -59,6 +59,9 @@ class Application(object): ...@@ -59,6 +59,9 @@ class Application(object):
"""Update the progress tracking.""" """Update the progress tracking."""
assert self.progress assert self.progress
def update_performance(self, msg):
"""Update the progress tracking."""
def update_phase_context(self, msg): def update_phase_context(self, msg):
"""Update the phase contextual information.""" """Update the phase contextual information."""
id = msg.cpu id = msg.cpu
......
...@@ -34,10 +34,27 @@ class Daemon(object): ...@@ -34,10 +34,27 @@ class Daemon(object):
container = self.container_manager.containers[cid] container = self.container_manager.containers[cid]
self.application_manager.register(msg, container) self.application_manager.register(msg, container)
elif msg.type == 'progress': elif msg.type == 'progress':
uuid = msg.container_uuid if msg.application_uuid in self.application_manager.applications:
if uuid in self.application_manager.applications: app = self.application_manager.applications[
app = self.application_manager.applications[uuid] msg.application_uuid]
app.update_progress(msg) app.update_performance(msg)
pub = {'api': 'up_pub',
'type': 'progress',
'payload': msg.payload,
'application_uuid': msg.application_uuid}
self.upstream_pub_server.sendmsg(
PUB_MSG['progress'](**pub))
elif msg.type == 'performance':
if msg.application_uuid in self.application_manager.applications:
app = self.application_manager.applications[
msg.application_uuid]
app.update_performance(msg)
pub = {'api': 'up_pub',
'type': 'performance',
'payload': msg.payload,
'container_uuid': msg.container_uuid}
self.upstream_pub_server.sendmsg(
PUB_MSG['performance'](**pub))
elif msg.type == 'phase_context': elif msg.type == 'phase_context':
uuid = msg.application_uuid uuid = msg.application_uuid
if uuid in self.application_manager.applications: if uuid in self.application_manager.applications:
......
...@@ -46,13 +46,22 @@ MSGFORMATS['up_pub'] = {'power': {'total': int, 'limit': float}, ...@@ -46,13 +46,22 @@ MSGFORMATS['up_pub'] = {'power': {'total': int, 'limit': float},
'power': dict}, 'power': dict},
'container_exit': {'container_uuid': basestring, 'container_exit': {'container_uuid': basestring,
'profile_data': dict}, 'profile_data': dict},
'performance': {'container_uuid': basestring,
'payload': int},
'progress': {'application_uuid': basestring,
'payload': int},
} }
MSGFORMATS['down_event'] = {'application_start': MSGFORMATS['down_event'] = {'application_start':
{'container_uuid': basestring, {'container_uuid': basestring,
'application_uuid': basestring}, 'application_uuid': basestring},
'application_exit': 'application_exit':
{'application_uuid': basestring}, {'application_uuid': basestring},
'progress': {'payload': int}, 'performance': {'payload': int,
'application_uuid': basestring,
'container_uuid': basestring},
'progress': {'payload': int,
'application_uuid': basestring,
'container_uuid': basestring},
'phase_context': {'cpu': int, 'phase_context': {'cpu': int,
'startcompute': int, 'startcompute': int,
'endcompute': int, 'endcompute': int,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment