{"action":"opened","issue":{"url":"https://api.github.com/repos/gbiggs/rtshell/issues/24","labels_url":"https://api.github.com/repos/gbiggs/rtshell/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/gbiggs/rtshell/issues/24/comments","events_url":"https://api.github.com/repos/gbiggs/rtshell/issues/24/events","html_url":"https://github.com/gbiggs/rtshell/issues/24","id":75756232,"number":24,"title":"rtcryo の副作用に起因する rtresurrect の問題","user":{"login":"gbiggs","id":163151,"avatar_url":"https://avatars.githubusercontent.com/u/163151?v=3","gravatar_id":"","url":"https://api.github.com/users/gbiggs","html_url":"https://github.com/gbiggs","followers_url":"https://api.github.com/users/gbiggs/followers","following_url":"https://api.github.com/users/gbiggs/following{/other_user}","gists_url":"https://api.github.com/users/gbiggs/gists{/gist_id}","starred_url":"https://api.github.com/users/gbiggs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gbiggs/subscriptions","organizations_url":"https://api.github.com/users/gbiggs/orgs","repos_url":"https://api.github.com/users/gbiggs/repos","events_url":"https://api.github.com/users/gbiggs/events{/privacy}","received_events_url":"https://api.github.com/users/gbiggs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-12T22:10:35Z","updated_at":"2015-05-12T22:10:35Z","closed_at":null,"body":"From 東京都立産業技術研究センター　佐々木さん\r\n\r\nrtresurrect ends up with the following error message and doesn't restore configuration parameters specified in a system profile saved with rtcryo.\r\n\r\n  rtresurrect: No such configuration set: default\r\n\r\nWorkaround:\r\nA. Execute rtresurrect 3 times with the same system profile.\r\nB. Alternatively, make all the RT components composing the system have some `conf.default' properties at initialization even if the configuration parameters are not used\r\n\r\nTest environment:\r\n- Ubuntu 12.04 LTS (x86_64)\r\n- rtshell (GitHub commit 4f3d49d83d0a20282c35b04ce3c35faad670aacf)\r\n- rtsprofile (GitHub commit 23ff6f62aada7fefe0930bf5f1afde4017dbf6c0)\r\n- rtctree (GitHub commit 630de13e64b0549eb9b49a111f2c223a6149eb1c)\r\n- OpenRTM-aist 1.1.0 (x86_64)\r\n- OpenRTM-aist-Python 1.1.0-RC1\r\n- Python 2.7.3\r\n- omniorb 4.1.6-1\r\n\r\nHow to reproduce the problem:\r\n# 設定 & 保存, Config. and save\r\n  [00]$ rtcwd /localhost/foo.host_cxt\r\n  [01]$ cd /usr/share/openrtm-1.1/example\r\n  [02]$ ./ConsoleInComp &  # --> job spec %1\r\n  [03]$ ./ConsoleOutComp & # --> job spec %2\r\n  [04]$ cd ~/test/\r\n  [05]$ python DoodleDoo.py # --> job spec %3,\r\n   # --> DoodleDoo は 2個の config set を持つ (default と mode1) RTC\r\n   #     ( DoodleDoo is an RTC that has 2 config sets, default and mode1. )\r\n   \r\n  [06]$ rtcon ConsoleIn0.rtc:out DoodleDoo0.rtc:in\r\n  [07]$ rtcon rtcon DoodleDoo0.rtc:out ConsoleOut0.rtc:in\r\n  [08]$ rtcat -ll ConsoleInComp |grep conf\r\n   # --> この時点では conf.default なし\r\n   #     (No `conf.default' at this point)\r\n   \r\n  [09]$ rtcryo -x -o test_sys.xml localhost\r\n   # --> test_sys.xml に ConsoleIn につき rts:activeConfigurationSet=\"default\" 指定なし\r\n   #    (`rts:activeConfigurationSet=\"default\"' not specified for ConsoleIn in test_sys.xml)\r\n   \r\n  [10]$ rtcat -ll ConsoleInComp |grep conf\r\n   # --> この時点では conf.default あり (rtcryo の副作用による)\r\n   #      (`conf.default' added at this point because of side effects of rtcryo)\r\n\r\n  [11]$ rtconf DoodleDoo0.rtc -s mode1 act\r\n  [12]$ rtconf DoodleDoo0.rtc\r\n      +default\r\n      +mode1*\r\n      \r\n  [14]$ rtcryo -x -o test_sys2.xml localhost\r\n   # --> test_sys2.xml に ConsoleIn につき rts:activeConfigurationSet=\"default\" 指定あり\r\n   #    (`rts:activeConfigurationSet=\"default\"' specified for ConsoleIn in test_sys.xml)\r\n  \r\n  # 復元, resurrection\r\n  [15]$ kill -9 %1 %2 %3\r\n  [16]$ cd /usr/share/openrtm-1.1/example\r\n  [17]$ ./ConsoleInComp &  \r\n  [18]$ ./ConsoleOutComp & \r\n  [19]$ cd ~/test/\r\n  [20]$ python DoodleDoo.py\r\n  [21]$ rtresurrect test_sys2.xml \r\n      rtresurrect: No such configuration set: default\r\n   # --> NoConfSetError 例外が発生する,\r\n   #     (NoConfSetError exception was raised)\r\n   #     at /usr/local/lib/python2.7/dist-packages/rtshell/actions.py, Line 318\r\n   \r\n  [22]$ rtconf DoodleDoo0.rtc \r\n      +default\r\n      +mode1\r\n   # --> どちらの config set も active でない\r\n   #     (no active config set)\r\n   \r\n  [23]$ rtresurrect test_sys2.xml \r\n      rtresurrect: No such configuration set: default\r\n  [24]$ rtconf DoodleDoo0.rtc \r\n      +default\r\n      +mode1*\r\n   # --> NoConfSetError 例外は発生するが DoodleDoo の設定は 復元される\r\n   #     ( NoConfSetError exception was raised, but the config set \r\n   #      for DoodleDoo was restored.)\r\n   \r\n  [25]$ rtresurrect test_sys2.xml\r\n   # --> もう一度実行すると エラーメッセージがでない (No error message)\r\n\r\nCauses:\r\nConsoleIn doesn't have the `conf.default' property at start [02]. But rtcryo has side effects to add the `conf.default' property to the component [08]-[10]. On executing rtcryo after changing config parameters in DoodleDoo, it saves the active config set specification for ConsoleIn in test_sys2.xml [14].\r\n\r\nBecause ConsoleIn doesn't have the `conf.default' property at restart [17],\r\nexecuting rtresurrect with test_sys2.xml will raise NoConfSetError [21].\r\n\r\nNoConfSetError exception raised for ConsoleIn keeps DoodleDoo away from configuration restoration since \"DoodleDoo\" is after \"ConsoleIn\" in order of actions taken by rtresurrect [22]. see /usr/local/lib/python2.7/dist-packages/rtshell/rtresurrect.py, Line 236.\r\n\r\nDoodleDoo.py (test component):\r\n\r\n#!/usr/bin/env python\r\n# -*- coding: utf-8 -*- \r\n# -*- Python -*-\r\n\r\nimport sys\r\nsys.path.append(\".\")\r\n\r\nimport RTC\r\nimport OpenRTM_aist\r\n\r\nmodule_spec = [\r\n  \"implementation_id\", \"DoodleDoo\", \r\n  \"type_name\",         \"DoodleDoo\", \r\n  \"description\",       \"DoodleDoo\", \r\n  \"version\",           \"0.1\", \r\n  \"vendor\",            \"xxxx\", \r\n  \"category\",          \"test\", \r\n  \"activity_type\",     \"DataFlowComponent\", \r\n  \"max_instance\",      \"10\", \r\n  \"language\",          \"Python\", \r\n  \"lang_type\",         \"SCRIPT\",\r\n  \"conf.default.coeff\", \"10\",\r\n  \"conf.mode1.coeff\",  \"5\",\r\n  \"\"]\r\n\r\n\r\n# //////////////////////////////////////////////////////////////////////////////\r\n#!\r\n#\r\nclass DoodleDoo(OpenRTM_aist.DataFlowComponentBase):\r\n  def __init__(self, manager):\r\n      OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)\r\n      self._coeff = [5]\r\n\r\n  def makeInPort(self, name, data):\r\n      port = OpenRTM_aist.InPort(name, data)\r\n      self.addInPort(name, port)      \r\n      return port\r\n  \r\n  def makeOutPort(self, name, data):\r\n      port = OpenRTM_aist.OutPort(name, data)\r\n      self.addOutPort(name, port)      \r\n      return port\r\n  \r\n  def onInitialize(self):\r\n      self._d_in = RTC.TimedLong(RTC.Time(0,0), 0)\r\n      self._inIn = self.makeInPort(\"in\", self._d_in)\r\n      self._d_out = RTC.TimedLong(RTC.Time(0,0), 0)\r\n      self._outOut = self.makeOutPort(\"out\", self._d_out)\r\n\r\n      self.bindParameter(\"coeff\", self._coeff, str(self._coeff[0]))\r\n      \r\n      return RTC.RTC_OK\r\n\r\n  def onActivated(self, ec_id):\r\n      return RTC.RTC_OK\r\n\r\n  def onDeactivated(self, ec_id):\r\n      return RTC.RTC_OK\r\n  \r\n  def onExecute(self, ec_id):\r\n      if self._inIn.isNew():\r\n          self._inIn.read()\r\n          self._d_out.data = self._coeff[0] * self._d_in.data\r\n          OpenRTM_aist.setTimestamp(self._d_out)\r\n          self._outOut.write()\r\n      return RTC.RTC_OK\r\n\r\ndef DoodleDooInit(manager):\r\n    profile = OpenRTM_aist.Properties(defaults_str=module_spec)\r\n    manager.registerFactory(profile,\r\n                            DoodleDoo,\r\n                            OpenRTM_aist.Delete)\r\n  \r\ndef MyModuleInit(manager):\r\n    DoodleDooInit(manager)\r\n    comp = manager.createComponent(\"DoodleDoo\")\r\n\r\ndef main():\r\n    mgr = OpenRTM_aist.Manager.init(sys.argv)\r\n    mgr.setModuleInitProc(MyModuleInit)\r\n    mgr.activateManager()\r\n    mgr.runManager()\r\n    \r\nif __name__ == '__main__':\r\n    main()"}}