Commit f41ef987 authored by Sridutt Bhalachandra's avatar Sridutt Bhalachandra

[Feature] Update container creation info in CManager

The container creation information (resources and powerpolicy) added to
`ContainerManager` class can be used to intiliaze power policy parameters
in the present and more in the future

See Issue #10
parent 7f94d98b
......@@ -7,7 +7,8 @@ import os
from subprograms import ChrtClient, NodeOSClient, resources
logger = logging.getLogger('nrm')
Container = namedtuple('Container', ['uuid', 'manifest', 'process'])
Container = namedtuple('Container', ['uuid', 'manifest', 'resources',
'powerpolicy', 'process'])
class ContainerManager(object):
......@@ -56,7 +57,8 @@ class ContainerManager(object):
environ['ARGO_CONTAINER_UUID'] = container_name
logger.info("creating container %s", container_name)
self.nodeos.create(container_name, allocation)
logger.info("created container %s", container_name)
container_resources = dict()
container_resources['cpus'], container_resources['mems'] = allocation
# Container power policy information
container_powerpolicy = dict()
......@@ -95,9 +97,11 @@ class ContainerManager(object):
argv.append(command)
argv.extend(args)
process = self.nodeos.execute(container_name, argv, environ)
c = Container(container_name, manifest, process)
c = Container(container_name, manifest, container_resources,
container_powerpolicy, process)
self.pids[process.pid] = c
self.containers[container_name] = c
logger.info("Container %s created and running : %r", container_name, c)
return c
def delete(self, uuid):
......
......@@ -86,6 +86,7 @@ class Daemon(object):
'uuid': container_uuid,
'errno': 0 if container else -1,
'pid': container.process.pid,
'powerpolicy': container.powerpolicy['policy']
}
self.upstream_pub.send_json(update)
# setup io callbacks
......
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