Commit 33316192 authored by Sridutt Bhalachandra's avatar Sridutt Bhalachandra

[fix] Multi-node support and msg layer interaction

Fixed the interaction of the multi-node support feature (#17) with the new
messaging layer feature. Also, added any other fixes required to make the
libnrm work with the Aggregative downstream API
parent a501c976
...@@ -4,7 +4,6 @@ from aci import ImageManifest ...@@ -4,7 +4,6 @@ from aci import ImageManifest
from collections import namedtuple from collections import namedtuple
import logging import logging
from subprograms import ChrtClient, NodeOSClient, resources from subprograms import ChrtClient, NodeOSClient, resources
import uuid
logger = logging.getLogger('nrm') logger = logging.getLogger('nrm')
Container = namedtuple('Container', ['uuid', 'manifest', 'resources', Container = namedtuple('Container', ['uuid', 'manifest', 'resources',
...@@ -35,20 +34,20 @@ class ContainerManager(object): ...@@ -35,20 +34,20 @@ class ContainerManager(object):
Returns the pid of the container or a negative number for errors.""" Returns the pid of the container or a negative number for errors."""
container = None container = None
container_name = None
containerexistsflag = False containerexistsflag = False
processes = None processes = None
clientids = None clientids = None
pp = None
manifestfile = request['manifest'] manifestfile = request['manifest']
command = request['file'] command = request['file']
args = request['args'] args = request['args']
environ = request['environ'] environ = request['environ']
ucontainername = request['uuid'] container_name = request['uuid']
logger.info("run: manifest file: %s", manifestfile) logger.info("run: manifest file: %s", manifestfile)
logger.info("run: command: %s", command) logger.info("run: command: %s", command)
logger.info("run: args: %r", args) logger.info("run: args: %r", args)
logger.info("run: ucontainername: %s", ucontainername) logger.info("run: container name: %s", container_name)
# TODO: Application library to load must be set during configuration # TODO: Application library to load must be set during configuration
apppreloadlibrary = self.pmpi_lib apppreloadlibrary = self.pmpi_lib
...@@ -64,10 +63,9 @@ class ContainerManager(object): ...@@ -64,10 +63,9 @@ class ContainerManager(object):
else: else:
argv = [] argv = []
# Check if user-specified container exists else create it # Check if container exists else create it
if ucontainername in self.containers: if container_name in self.containers:
container_name = ucontainername container = self.containers[container_name]
container = self.containers[ucontainername]
containerexistsflag = True containerexistsflag = True
processes = container.processes processes = container.processes
clientids = container.clientids clientids = container.clientids
...@@ -75,12 +73,6 @@ class ContainerManager(object): ...@@ -75,12 +73,6 @@ class ContainerManager(object):
processes = dict() processes = dict()
clientids = dict() clientids = dict()
if ucontainername:
container_name = ucontainername
else:
# If no user-specified container name create one
container_name = str(uuid.uuid4())
# ask the resource manager for resources # ask the resource manager for resources
req = resources(int(manifest.app.isolators.container.cpus.value), req = resources(int(manifest.app.isolators.container.cpus.value),
int(manifest.app.isolators.container.mems.value)) int(manifest.app.isolators.container.mems.value))
...@@ -123,7 +115,6 @@ class ContainerManager(object): ...@@ -123,7 +115,6 @@ class ContainerManager(object):
container_power['policy'] = pp.policy container_power['policy'] = pp.policy
container_power['damper'] = pp.damper container_power['damper'] = pp.damper
container_power['slowdown'] = pp.slowdown container_power['slowdown'] = pp.slowdown
environ['LD_PRELOAD'] = apppreloadlibrary
# build context to execute # build context to execute
# environ['PATH'] = ("/usr/local/sbin:" # environ['PATH'] = ("/usr/local/sbin:"
...@@ -132,6 +123,14 @@ class ContainerManager(object): ...@@ -132,6 +123,14 @@ class ContainerManager(object):
environ['PERF'] = self.linuxperf environ['PERF'] = self.linuxperf
environ['AC_APP_NAME'] = manifest.name environ['AC_APP_NAME'] = manifest.name
environ['AC_METADATA_URL'] = "localhost" environ['AC_METADATA_URL'] = "localhost"
if (containerexistsflag and container.power['policy'] is not None) or (
pp is not None and pp.policy != "NONE"):
environ['LD_PRELOAD'] = apppreloadlibrary
environ['NRM_TRANSMIT'] = '1'
if containerexistsflag:
environ['NRM_DAMPER'] = container.power['damper']
else:
environ['NRM_DAMPER'] = pp.damper
argv.append(command) argv.append(command)
argv.extend(args) argv.extend(args)
......
...@@ -7,6 +7,7 @@ from powerpolicy import PowerPolicyManager ...@@ -7,6 +7,7 @@ from powerpolicy import PowerPolicyManager
from functools import partial from functools import partial
import logging import logging
import os import os
import socket
from resources import ResourceManager from resources import ResourceManager
from sensor import SensorManager from sensor import SensorManager
import signal import signal
...@@ -248,6 +249,7 @@ class Daemon(object): ...@@ -248,6 +249,7 @@ class Daemon(object):
if p['policy']: if p['policy']:
diff['damper'] = float(p['damper'])/1000000000 diff['damper'] = float(p['damper'])/1000000000
diff['slowdown'] = p['slowdown'] diff['slowdown'] = p['slowdown']
diff['nodename'] = socket.gethostname()
logger.info("Container %r profile data: %r", logger.info("Container %r profile data: %r",
container.uuid, diff) container.uuid, diff)
msg['profile_data'] = diff msg['profile_data'] = diff
......
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