Commit c8ea2ffd authored by Valentin Reis's avatar Valentin Reis

Integrated process-mgt branch properly.

parent b83309be
Pipeline #4381 passed with stages
in 2 minutes and 14 seconds
......@@ -12,7 +12,6 @@ import uuid
logger = logging.getLogger('perf-wrapper')
class PerfWrapper(object):
"""Implements middleware between the Linux perf and
......@@ -49,6 +48,8 @@ class PerfWrapper(object):
# retrieve our container uuid
self.container_uuid = os.environ.get('ARGO_CONTAINER_UUID')
# logger.error("container uuid:",str(self.container_uuid))
# logger.error("environ:",dict(os.environ))
if self.container_uuid is None:
logger.error("missing container uuid")
exit(1)
......@@ -73,6 +74,9 @@ class PerfWrapper(object):
parser.add_argument("-f", "--frequency",
help="sampling frequency in ms",
type=int, default=1000)
parser.add_argument("-l", "--logfile",
help="perf-wrapper log file",
type=str, default="/tmp/argo-perf-wrapper.log")
parser.add_argument("cmd", help="command and arguments",
nargs=argparse.REMAINDER)
args = parser.parse_args()
......@@ -80,6 +84,10 @@ class PerfWrapper(object):
if args.verbose:
logger.setLevel(logging.DEBUG)
if args.logfile:
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.FileHandler(args.logfile))
logger.info("cmd: %r", args.cmd)
self.setup()
......@@ -141,6 +149,6 @@ class PerfWrapper(object):
if __name__ == "__main__":
logging.basicConfig(level=logging.WARNING)
# logging.basicConfig(level=logging.INFO)
wrapper = PerfWrapper()
wrapper.main()
......@@ -25,7 +25,8 @@ def main(argv=None):
args, remaining_argv = conf_parser.parse_known_args()
defaults = { "log":"/tmp/argo_daemon.log"
, "log_power":"/tmp/argo_daemon_power.log" }
, "log_power":"/tmp/argo_daemon_power.log"
, "powerstrategy":"0" }
if args.print_defaults:
print defaults
......@@ -38,6 +39,7 @@ def main(argv=None):
parser.set_defaults(**defaults)
parser.add_argument("--log", help="Main log file.",metavar="FILE")
parser.add_argument("--log_power", help="Power data log file (High throughput).",metavar="FILE")
parser.add_argument("--powerstrategy", help="Power management strategy.",metavar="STRATEGY")
args = parser.parse_args(remaining_argv)
nrm.daemon.runner(config=args)
return(0)
......
......@@ -58,6 +58,7 @@ class Application(object):
def update_progress(self, msg):
"""Update the progress tracking."""
assert self.progress
logger.info("received progress message: "+str(msg))
def update_phase_context(self, msg):
"""Update the phase contextual information."""
......
......@@ -20,7 +20,7 @@ RPC_MSG = MSGTYPES['up_rpc_rep']
PUB_MSG = MSGTYPES['up_pub']
logger = logging.getLogger('nrm')
logger_power = logging.getLogger('power')
class Daemon(object):
......@@ -169,6 +169,7 @@ class Daemon(object):
def do_control(self):
plan = self.controller.planify(self.target, self.machine_info)
logger.info("Controller chose plan " + str(plan))
action, actuator = plan
if action:
self.controller.execute(action, actuator)
......@@ -321,15 +322,15 @@ class Daemon(object):
def runner(config):
ioloop.install()
logger.setLevel(logging.DEBUG)
logger_power.setLevel(logging.DEBUG)
if config.log:
print("Logging to %s" % config.log)
print("Logging nrm to %s" % config.log)
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.FileHandler(config.log))
if config.log_power:
print("Logging power data to %s" % config.log_power)
logger_power = logging.getLogger('power')
logger_power.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(message)s')
handler = logging.FileHandler(config.log_power)
handler.setFormatter(formatter)
......
......@@ -118,6 +118,7 @@ class NodeOSClient(object):
for envname, envval in environ.items()]
cmd += " env:'"+" ".join(env)+"'"
args.append(cmd)
logger.debug(args)
return process.Subprocess(args, stdin=process.Subprocess.STREAM,
stdout=process.Subprocess.STREAM,
stderr=process.Subprocess.STREAM)
......
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