from nepi.execution.trace import Trace, TraceAttr
from nepi.execution.resource import ResourceManager, clsinit_copy, \
ResourceState, ResourceAction
-from nepi.util.sshfuncs import ProcStatus
import os
import tempfile
@classmethod
def _register_attributes(cls):
- trace_name = Attribute("traceName",
- "Name of the trace to be collected",
- flags = Flags.Design)
-
- sub_dir = Attribute("subDir",
- "Sub directory to collect traces into",
- flags = Flags.Design)
-
- rename = Attribute("rename",
- "Name to give to the collected trace file",
- flags = Flags.Design)
-
- cls._register_attribute(trace_name)
- cls._register_attribute(sub_dir)
- cls._register_attribute(rename)
+ cls._register_attribute(
+ Attribute("traceName",
+ "Name of the trace to be collected",
+ flags = Flags.Design))
+ cls._register_attribute(
+ Attribute("subDir",
+ "Sub directory to collect traces into",
+ flags = Flags.Design))
+ cls._register_attribute(
+ Attribute("rename",
+ "Name to give to the collected trace file",
+ flags = Flags.Design))
def __init__(self, ec, guid):
super(Collector, self).__init__(ec, guid)
if subdir:
self._store_path = os.path.join(self.store_path, subdir)
- msg = "Creating local directory at %s to store %s traces " % (
- self.store_path, trace_name)
+ msg = "Creating local directory at {} to store {} traces "\
+ .format(self.store_path, trace_name)
self.info(msg)
try:
trace_name = self.get("traceName")
rename = self.get("rename") or trace_name
- msg = "Collecting '%s' traces to local directory %s" % (
- trace_name, self.store_path)
+ msg = "Collecting '{}' traces to local directory {}"\
+ .format(trace_name, self.store_path)
self.info(msg)
rms = self.get_connected()
for rm in rms:
- fpath = os.path.join(self.store_path, "%d.%s" % (rm.guid,
- rename))
+ fpath = os.path.join(self.store_path, "{}.{}"\
+ .format(rm.guid, rename))
try:
result = self.ec.trace(rm.guid, trace_name)
+ print("collector.do_release ..")
with open(fpath, "w") as f:
f.write(result)
except:
import traceback
err = traceback.format_exc()
- msg = "Couldn't retrieve trace %s for %d at %s " % (trace_name,
- rm.guid, fpath)
+ msg = "Couldn't retrieve trace {} for {} at {} "\
+ .format(trace_name, rm.guid, fpath)
self.error(msg, out = "", err = err)
continue
@classmethod
def _register_traces(cls):
- stdout = Trace("stdout", "Standard output stream", enabled = True)
- stderr = Trace("stderr", "Standard error stream", enabled = True)
-
- cls._register_trace(stdout)
- cls._register_trace(stderr)
+ cls._register_trace(
+ Trace("stdout", "Standard output stream", enabled = True))
+ cls._register_trace(
+ Trace("stderr", "Standard error stream", enabled = True))
def __init__(self, ec, guid):
super(LinuxApplication, self).__init__(ec, guid)