[openrtm-commit:02860] r882 - in branches/RELENG_1_2/OpenRTM-aist-Python: . OpenRTM_aist OpenRTM_aist/ext/logger/fluentbit_stream
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 10月 6日 (金) 15:45:48 JST
Author: kawauchi
Date: 2017-10-06 15:45:48 +0900 (Fri, 06 Oct 2017)
New Revision: 882
Modified:
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextWorker.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExtTrigExecutionContext.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/LogstreamBase.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/LogstreamFile.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PublisherPeriodic.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/SystemLogger.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ext/logger/fluentbit_stream/FluentBit.py
branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/uuid.py
branches/RELENG_1_2/OpenRTM-aist-Python/setup.py
Log:
[merge] r876-880 have been merged from trunk.
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextBase.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -421,6 +421,19 @@
self.setProperties(props)
return
+ ##
+ # @if jp
+ # @brief ExecutionContext¤Î½ªÎ»½èÍý
+ #
+ # @else
+ # @brief
+ #
+ # @endif
+ # virtual void exit();
+ def exit(self):
+ self._rtcout.RTC_TRACE("exit()")
+ self._profile.exit()
+ self._worker.exit()
##
# @if jp
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextProfile.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -79,9 +79,9 @@
##
# @if jp
- # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @brief ExecitionContextProfile½ªÎ»½èÍý
#
- # ¥Ç¥¹¥È¥é¥¯¥¿
+ #
#
# @else
# @brief Destructor
@@ -89,8 +89,8 @@
# Destructor
#
# @endif
- def __del__(self):
- self._rtcout.RTC_TRACE("ExecutionContextProfile.__del__()")
+ def exit(self):
+ self._rtcout.RTC_TRACE("exit")
# cleanup EC's profile
self._profile.owner = None
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextWorker.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextWorker.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExecutionContextWorker.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -81,18 +81,18 @@
##
# @if jp
- # @brief ¥Ç¥¹¥È¥é¥¯¥¿
+ # @brief ExecutionContextWorker½ªÎ»½èÍý
#
- # ¥Ç¥¹¥È¥é¥¯¥¿
+ #
#
# @else
- # @brief Destructor
+ # @brief
#
- # Destructor
+ #
#
# @endif
- def __del__(self):
- self._rtcout.RTC_TRACE("~ExecutionContextWorker.__del__")
+ def exit(self):
+ self._rtcout.RTC_TRACE("exit")
return
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExtTrigExecutionContext.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExtTrigExecutionContext.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ExtTrigExecutionContext.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -75,8 +75,8 @@
return
- def __del__(self, Task=OpenRTM_aist.Task):
- self._rtcout.RTC_TRACE("ExtTrigExecutionContext.__del__()")
+ def exit(self, Task=OpenRTM_aist.Task):
+ self._rtcout.RTC_TRACE("exit")
guard = OpenRTM_aist.ScopedLock(self._svcmutex)
self._svc = False
del guard
@@ -89,6 +89,7 @@
del guard
self.wait()
Task.__del__(self)
+ OpenRTM_aist.ExecutionContextBase.exit(self)
return
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/LogstreamBase.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/LogstreamBase.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/LogstreamBase.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -123,7 +123,7 @@
#
# @endif
#
- def log(self, msg, level):
+ def log(self, msg, level, name):
return False
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/LogstreamFile.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/LogstreamFile.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/LogstreamFile.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -201,6 +201,7 @@
# @param self
# @param msg¡¡¥í¥°½ÐÎϤ¹¤ëʸ»úÎó
# @param level ¥í¥°¥ì¥Ù¥ë
+ # @param name ¥í¥°¤Î½ÐÎÏ̾
# @return
#
# @else
@@ -210,31 +211,33 @@
# @param self
# @param msg
# @param level
+ # @param name
# @return
#
# @endif
#
- def log(self, msg, level):
+ def log(self, msg, level, name):
+ log = self.getLogger(name)
if level == OpenRTM_aist.Logger.FATAL:
- self.logger.log(logging.FATAL,msg)
+ log.log(logging.FATAL,msg)
elif level == OpenRTM_aist.Logger.ERROR:
- self.logger.error(msg)
+ log.error(msg)
elif level == OpenRTM_aist.Logger.WARN:
- self.logger.warning(msg)
+ log.warning(msg)
elif level == OpenRTM_aist.Logger.INFO:
- self.logger.info(msg)
+ log.info(msg)
elif level == OpenRTM_aist.Logger.DEBUG:
- self.logger.debug(msg)
+ log.debug(msg)
elif level == OpenRTM_aist.Logger.TRACE:
- self.logger.log(logging.TRACE,msg)
+ log.log(logging.TRACE,msg)
elif level == OpenRTM_aist.Logger.VERBOSE:
- self.logger.log(logging.VERBOSE,msg)
+ log.log(logging.VERBOSE,msg)
elif level == OpenRTM_aist.Logger.PARANOID:
- self.logger.log(logging.PARANOID,msg)
+ log.log(logging.PARANOID,msg)
else:
return False
-
return True
+
##
@@ -306,7 +309,38 @@
self.handlers = []
return True
+ ##
+ # @if jp
+ # @brief ¥í¥¬¡¼¤Î¼èÆÀ
+ #
+ #
+ # @param self
+ # @param name ¥í¥°¤Î½ÐÎÏ̾
+ # @return¡¡¥í¥¬¡¼
+ #
+ # @else
+ # @brief
+ #
+ #
+ # @param self
+ # @param name
+ # @return
+ #
+ # @endif
+ #
+ def getLogger(self, name):
+ if name:
+ return logging.getLogger("file."+name)
+ else:
+ return self.logger
+
+
+
+
+
+
+
def LogstreamFileInit():
OpenRTM_aist.LogstreamFactory.instance().addFactory("file",
OpenRTM_aist.LogstreamFile,
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/Manager.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -2766,14 +2766,14 @@
# @endif
def getLogbuf(self,name="manager"):
if not OpenRTM_aist.toBool(self._config.getProperty("logger.enable"), "YES", "NO", True):
- return OpenRTM_aist.LogStream()
+ return OpenRTM_aist.LogStream().getLogger(name)
if self._rtcout is None:
self._rtcout = OpenRTM_aist.LogStream(name)
self._rtcout.setLogLevel(self._config.getProperty("logger.log_level"))
- return self._rtcout
+ return self._rtcout.getLogger(name)
else:
- return self._rtcout
+ return self._rtcout.getLogger(name)
##
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ModuleManager.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -126,7 +126,7 @@
# @else
#
# @endif
- class Error:
+ class Error(Exception):
def __init__(self, reason_):
self.reason = reason_
@@ -139,7 +139,7 @@
# @else
#
# @endif
- class NotFound:
+ class NotFound(Exception):
def __init__(self, name_):
self.name = name_
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -79,7 +79,7 @@
return
- def __del__(self, Task=OpenRTM_aist.Task):
+ def exit(self, Task=OpenRTM_aist.Task):
import OpenRTM_aist.Guard
self._rtcout.RTC_TRACE("PeriodicExecutionContext.__del__()")
guard = OpenRTM_aist.Guard.ScopedLock(self._svcmutex)
@@ -94,6 +94,7 @@
del guard
self.wait()
Task.__del__(self)
+ OpenRTM_aist.ExecutionContextBase.exit(self)
return
def init(self, props):
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PublisherNew.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -678,7 +678,7 @@
loopcnt = preskip/(self._skipn+1)
postskip = self._skipn - self._leftskip
- for i in range(loopcnt):
+ for i in range(int(loopcnt)):
self._buffer.advanceRptr(postskip)
cdr = self._buffer.get()
self.onBufferRead(cdr)
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PublisherPeriodic.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PublisherPeriodic.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/PublisherPeriodic.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -714,7 +714,7 @@
preskip = self._buffer.readable() + self._leftskip
loopcnt = preskip / (self._skipn + 1)
postskip = self._skipn - self._leftskip
- for i in range(loopcnt):
+ for i in range(int(loopcnt)):
self._buffer.advanceRptr(postskip)
cdr = self._buffer.get()
self.onBufferRead(cdr)
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/RTObject.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -3559,14 +3559,14 @@
def finalizeContexts(self):
self._rtcout.RTC_TRACE("finalizeContexts()")
len_ = len(self._eclist)
- for i in range(len_):
- idx = (len_ - 1) - i
- self._eclist[idx].stop()
+ for ec in self._eclist:
+ ec.stop()
try:
- self._poa.deactivate_object(self._poa.servant_to_id(self._eclist[idx]))
+ self._poa.deactivate_object(self._poa.servant_to_id(ec))
except:
self._rtcout.RTC_TRACE(OpenRTM_aist.Logger.print_exception())
- del self._eclist[idx]
+ ec.exit()
+ self._eclist = []
return
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/SystemLogger.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/SystemLogger.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/SystemLogger.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -21,6 +21,7 @@
import logging
import OpenRTM_aist
+import copy
@@ -181,7 +182,7 @@
-
+ self._logger_name = ""
self._mutex = threading.RLock()
self._loggerObj = []
self._log_enable = True
@@ -338,7 +339,7 @@
print("RTC_LOG : argument error")
return
for log in self._loggerObj:
- log.log(messages, LV)
+ log.log(messages, LV, self._logger_name)
self.release()
@@ -376,7 +377,7 @@
return
for log in self._loggerObj:
- log.log(messages, Logger.FATAL)
+ log.log(messages, Logger.FATAL, self._logger_name)
self.release()
@@ -414,7 +415,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.ERROR)
+ log.log(messages, Logger.ERROR, self._logger_name)
self.release()
@@ -456,7 +457,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.WARN)
+ log.log(messages, Logger.WARN, self._logger_name)
self.release()
@@ -498,7 +499,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.INFO)
+ log.log(messages, Logger.INFO, self._logger_name)
self.release()
@@ -540,7 +541,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.DEBUG)
+ log.log(messages, Logger.DEBUG, self._logger_name)
self.release()
@@ -583,7 +584,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.TRACE)
+ log.log(messages, Logger.TRACE, self._logger_name)
self.release()
@@ -626,7 +627,7 @@
for log in self._loggerObj:
- log.log(messages, Logger.VERBOSE)
+ log.log(messages, Logger.VERBOSE, self._logger_name)
self.release()
@@ -670,12 +671,16 @@
for log in self._loggerObj:
- log.log(messages, Logger.PARANOID)
+ log.log(messages, Logger.PARANOID, self._logger_name)
self.release()
+ def getLogger(self, name):
+ syslogger = copy.copy(self)
+ syslogger._logger_name = name
+ return syslogger
+
-
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ext/logger/fluentbit_stream/FluentBit.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ext/logger/fluentbit_stream/FluentBit.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/ext/logger/fluentbit_stream/FluentBit.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -272,6 +272,7 @@
# @param self
# @param msg¡¡¥í¥°½ÐÎϤ¹¤ëʸ»úÎó
# @param level ¥í¥°¥ì¥Ù¥ë
+ # @param name ¥í¥°¤Î½ÐÎÏ̾
# @return
#
# @else
@@ -281,27 +282,29 @@
# @param self
# @param msg
# @param level
+ # @param name
# @return
#
# @endif
#
- def log(self, msg, level):
+ def log(self, msg, level, name):
+ log = self.getLogger(name)
if level == OpenRTM_aist.Logger.FATAL:
- self.logger.log(logging.FATAL,msg)
+ log.log(logging.FATAL,msg)
elif level == OpenRTM_aist.Logger.ERROR:
- self.logger.error(msg)
+ log.error(msg)
elif level == OpenRTM_aist.Logger.WARN:
- self.logger.warning(msg)
+ log.warning(msg)
elif level == OpenRTM_aist.Logger.INFO:
- self.logger.info(msg)
+ log.info(msg)
elif level == OpenRTM_aist.Logger.DEBUG:
- self.logger.debug(msg)
+ log.debug(msg)
elif level == OpenRTM_aist.Logger.TRACE:
- self.logger.log(logging.TRACE,msg)
+ log.log(logging.TRACE,msg)
elif level == OpenRTM_aist.Logger.VERBOSE:
- self.logger.log(logging.VERBOSE,msg)
+ log.log(logging.VERBOSE,msg)
elif level == OpenRTM_aist.Logger.PARANOID:
- self.logger.log(logging.PARANOID,msg)
+ log.log(logging.PARANOID,msg)
else:
return False
@@ -379,7 +382,32 @@
FluentBit.s_logger = None
return True
+ ##
+ # @if jp
+ # @brief ¥í¥¬¡¼¤Î¼èÆÀ
+ #
+ #
+ # @param self
+ # @param name ¥í¥°¤Î½ÐÎÏ̾
+ # @return¡¡¥í¥¬¡¼
+ #
+ # @else
+ # @brief
+ #
+ #
+ # @param self
+ # @param name
+ # @return
+ #
+ # @endif
+ #
+ def getLogger(self, name):
+ if name:
+ return logging.getLogger("fluent."+name)
+ else:
+ return self.logger
+
def FluentBitInit(mgr):
OpenRTM_aist.LogstreamFactory.instance().addFactory("fluentd",
FluentBit,
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/uuid.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/uuid.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/OpenRTM_aist/uuid.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -26,6 +26,8 @@
+
+
##
# @if jp
# @class UUID
@@ -76,7 +78,9 @@
if bytes:
if len(bytes) != 16:
raise ValueError('bytes is not a 16-char string')
- int_value = long(('%02x'*16) % tuple(map(ord, bytes)), 16)
+ def ord_func(v):
+ return ord(chr(v))
+ int_value = long(('%02x'*16) % tuple(map(ord_func, bytes)), 16)
if fields:
if len(fields) != 6:
raise ValueError('fields is not a 6-tuple')
Modified: branches/RELENG_1_2/OpenRTM-aist-Python/setup.py
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Python/setup.py 2017-10-06 06:17:12 UTC (rev 881)
+++ branches/RELENG_1_2/OpenRTM-aist-Python/setup.py 2017-10-06 06:45:48 UTC (rev 882)
@@ -182,6 +182,8 @@
"OpenRTM_aist.RTM_IDL.SDOPackage",
"OpenRTM_aist.RTM_IDL.SDOPackage__POA",
"OpenRTM_aist.RTM_IDL.device_interfaces",
+ "OpenRTM_aist.RTM_IDL._GlobalIDL",
+ "OpenRTM_aist.RTM_IDL._GlobalIDL__POA",
]
openrtm_ext_packages = [
"OpenRTM_aist.ext",
@@ -222,10 +224,16 @@
pkg_scripts_unix = ['OpenRTM_aist/utils/rtcd/rtcd_python',
'OpenRTM_aist/utils/rtcprof/rtcprof_python']
pkg_scripts_win32 = ['OpenRTM_aist/utils/rtcd/rtcd.py',
- 'OpenRTM_aist/utils/rtcd/rtcd_python.exe',
+# 'OpenRTM_aist/utils/rtcd/rtcd_python.exe',
'OpenRTM_aist/utils/rtcd/rtcd_python.bat',
'OpenRTM_aist/utils/rtcprof/rtcprof_python.py',
'OpenRTM_aist/utils/rtcprof/rtcprof_python.bat']
+
+
+pkg_data_files_unix = []
+pkg_data_files_win32 = [("Scripts", ['OpenRTM_aist/utils/rtcd/rtcd_python.exe'])]
+
+
#
# ext modules
#
@@ -985,9 +993,14 @@
#
if os_is() == "win32":
pkg_scripts = pkg_scripts_win32
+ pkg_data_files = pkg_data_files_win32
else:
pkg_scripts = pkg_scripts_unix
+ pkg_data_files = pkg_data_files_unix
+
+
+
#
# example file list -> MyDistribution.example_files
#
@@ -1047,6 +1060,7 @@
package_dir = {module_dir: module_dir},
package_data = pkg_package_data_files,
scripts = pkg_scripts,
+ data_files = pkg_data_files,
example_files = pkg_example_files,
document_files = pkg_document_files,
)
More information about the openrtm-commit
mailing list