iotile / coretools

Core python tools for building and using IOTile based devices
GNU General Public License v3.0
14 stars 7 forks source link

[iotile-ship] [iotile-transport-jlink] jlink resource no longer closes properly in iotile-ship recipes #911

Open x24ling opened 5 years ago

x24ling commented 5 years ago

I believe this has something to do with how iotile-transport-jlink is now asynchronous, something probably needs to change with regards to how Resources are managed in iotile-ship Error Message:

iotile-ship .\os_2059_v1_1_bootstrap.ship -d uuid=0xb1f
c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\ship\recipe.py:355: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  info = yaml.load(infile)
Running in C:\Users\chris\AppData\Local\Temp\tmpsrfp52ro\os_2059_v1_1_bootstrap
===> Step 1: FlashBoardStep      Description: Flash slot 1 (GPIO Pipeline)
======> Time Elapsed: 5.67 seconds
===> Step 2: FlashBoardStep      Description: Flash Controller
Traceback (most recent call last):
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\ship\recipe.py", line 455, in run
    runtime, out = _run_step(step, decl, initialized_resources)
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\ship\recipe.py", line 539, in _run_step
    out = step_obj.run(resources=used_resources)
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\core\hw\debug\flash_board_step.py", line 37, in run
    debug = hwman.hwman.debug(self._debug_string)
  File "<c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\decorator.py:decorator-gen-26>", line 2, in debug
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\typedargs\utils.py", line 32, in _check_and_execute
    retval = func(*convargs, **convkw)
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\core\hw\hwmanager.py", line 306, in debug
    self.stream.connect_direct(connection_string, no_rpc=True)
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\core\hw\transport\adapterstream.py", line 211, in connect_direct
    raise HardwareError("Cannot connect when we are already connected to '%s'" % self.connection_string)
iotile.core.exceptions.HardwareError: HardwareError: Cannot connect when we are already connected to 'device=lpc824;channel=1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\chris\iotile\env\new_prod_workspace\Scripts\iotile-ship.exe\__main__.py", line 7, in <module>
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\ship\scripts\iotile_ship.py", line 99, in main
    recipe.run(variables)
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\ship\recipe.py", line 461, in run
    self._cleanup_resources(owned_resources)
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\ship\recipe.py", line 418, in _cleanup_resources
    raise RecipeResourceManagementError(operation="resource cleanup", errors=cleanup_errors)
TypeError: __init__() missing 1 required positional argument: 'msg'
Error running finalizer for task JLINK Adapter stopper
Traceback (most recent call last):
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\core\utilities\async_tools\event_loop.py", line 193, in stop
    await result
  File "c:\users\chris\iotile\coretools\transport_plugins\jlink\iotile_transport_jlink\jlink.py", line 197, in stop
    await self.disconnect(self._connection_id)
  File "c:\users\chris\iotile\coretools\transport_plugins\jlink\iotile_transport_jlink\jlink.py", line 313, in disconnect
    self._teardown_connection(conn_id)
  File "c:\users\chris\iotile\env\new_prod_workspace\lib\site-packages\iotile\core\hw\transport\adapter\mixin_conndata.py", line 62, in _teardown_connection
    raise DeviceAdapterError(conn_id, 'none', 'connection id torndown without being setup')
iotile.core.hw.exceptions.DeviceAdapterError: DeviceAdapterError: Operation none on conn 0 failed because connection id torndown without being setup
Additional Information:
reason: connection id torndown without being setup
operation: none
conn_id: 0
x24ling commented 5 years ago

pip list output:;

iotile-build                         3.0.11
iotile-cloud                         0.9.9
iotile-core                          5.0.9
iotile-emulate                       0.5.0
iotile-ext-cloud                     1.0.9
iotile-gateway                       3.0.0
iotile-sensorgraph                   1.0.7
iotile-ship                          1.0.7
iotile-support-con-nrf52832-2        2.15.4
iotile-support-con-nrf52832-3        3.2.4
iotile-support-con-nrf52832-4        4.0.0
iotile-support-firm-gpiopipe-1       1.2.0
iotile-support-lib-controller-3      3.8.2
iotile-support-lib-controller-4      4.0.0
iotile-test                          2.0.1
iotile-transport-awsiot              1.0.4
iotile-transport-bled112             3.0.1
iotile-transport-jlink               1.1.0
iotile-transport-websocket           3.0.0

Note: This issue will prevent us from using iotile-ship in directly bootstrapping PODs