Skip to content

Set of fixes

Mateusz Żebrak requested to merge mzebrak/fixes into develop

Fix issue with missing setup calls of TextualWorld

An error was observable in CLI:

(clive-py3.10) hived_admin@ef13c8e17cd1:/clive$ clive transfer --profile alice --password alice --sign 'default alice key' --to bob --amount '1.000 HIVE'
Launching beekeeper...
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /clive/clive/__private/cli/common/operation_common.py:81 in wrapper │
│ │
│ 78 │ │ │ │ │ await world.commands.activate(password=password) │
│ 79 │ │ │ │ │ await func(ctx, args, *kwargs) │
│ 80 │ │ │ │
│ ❱ 81 │ │ │ asyncio_run(impl()) │
│ 82 │ │ │
│ 83 │ │ return wrapper # type: ignore[no-any-return] │
│ 84 │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ args = () │ │
│ │ beekeeper_remote = None │ │
│ │ beekeeper_remote_endpoint = None │ │
│ │ broadcast = True │ │
│ │ cls = <class │ │
│ │ 'clive.__private.cli.common.operation_common.OperationCommon'> │ │
│ │ ctx = <click.core.Context object at 0x7efeb8b44340> │ │
│ │ ExitCallHandler = <class 'clive.__private.core.exit_call_handler.ExitCallHandler'> │ │
│ │ func = <function _main at 0x7efeb8c8cb80> │ │
│ │ impl = <function │ │
│ │ OperationCommon.decorator.<locals>.wrapper.<locals>.impl at │ │
│ │ 0x7efeb8b26950> │ │
│ │ kwargs = {'to': 'bob', 'amount': '1.000 HIVE', 'memo': ''} │ │
│ │ password = 'alice' │ │
│ │ profile = 'alice' │ │
│ │ save_file = None │ │
│ │ sign = 'default alice key' │ │
│ │ TyperWorld = <class 'clive.__private.core.world.TyperWorld'> │ │
│ │ Url = <class 'clive.core.url.Url'> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /clive/clive/__private/core/_async.py:25 in asyncio_run │
│ │
│ 22 │ async def await_for_given_awaitable() -> T: │
│ 23 │ │ return await awaitable │
│ 24 │ │
│ ❱ 25 │ return thread_pool.submit(asyncio.run, await_for_given_awaitable()).result() │
│ 26 │
│ 27 │
│ 28 async def event_wait(event: asyncio.Event, timeout: float | None = None) -> bool: │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ await_for_given_awaitable = <function asyncio_run.<locals>.await_for_given_awaitable at │ │
│ │ 0x7efeb8b269e0> │ │
│ │ awaitable = <coroutine object │ │
│ │ OperationCommon.decorator.<locals>.wrapper.<locals>.impl at │ │
│ │ 0x7efeb8cdcdd0> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/lib/python3.10/concurrent/futures/_base.py:458 in result │
│ │
│ 455 │ │ │ │ if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: │
│ 456 │ │ │ │ │ raise CancelledError() │
│ 457 │ │ │ │ elif self._state == FINISHED: │
│ ❱ 458 │ │ │ │ │ return self.__get_result() │
│ 459 │ │ │ │ else: │
│ 460 │ │ │ │ │ raise TimeoutError() │
│ 461 │ │ finally: │
│ │
│ ╭──── locals ────╮ │
│ │ self = None │ │
│ │ timeout = None │ │
│ ╰────────────────╯ │
│ │
│ /usr/lib/python3.10/concurrent/futures/_base.py:403 in __get_result │
│ │
│ 400 │ def __get_result(self): │
│ 401 │ │ if self._exception: │
│ 402 │ │ │ try: │
│ ❱ 403 │ │ │ │ raise self._exception │
│ 404 │ │ │ finally: │
│ 405 │ │ │ │ # Break a reference cycle with the exception in self._exception │
│ 406 │ │ │ │ self = None │
│ │
│ ╭── locals ───╮ │
│ │ self = None │ │
│ ╰─────────────╯ │
│ │
│ /usr/lib/python3.10/concurrent/futures/thread.py:58 in run │
│ │
│ 55 │ │ │ return │
│ 56 │ │ │
│ 57 │ │ try: │
│ ❱ 58 │ │ │ result = self.fn(*self.args, **self.kwargs) │
│ 59 │ │ except BaseException as exc: │
│ 60 │ │ │ self.future.set_exception(exc) │
│ 61 │ │ │ # Break a reference cycle with the exception 'exc' │
│ │
│ ╭── locals ───╮ │
│ │ self = None │ │
│ ╰─────────────╯ │
│ │
│ /usr/lib/python3.10/asyncio/runners.py:44 in run │
│ │
│ 41 │ │ events.set_event_loop(loop) │
│ 42 │ │ if debug is not None: │
│ 43 │ │ │ loop.set_debug(debug) │
│ ❱ 44 │ │ return loop.run_until_complete(main) │
│ 45 │ finally: │
│ 46 │ │ try: │
│ 47 │ │ │ _cancel_all_tasks(loop) │
│ │
│ ╭────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ debug = None │ │
│ │ loop = <_UnixSelectorEventLoop running=False closed=True debug=False> │ │
│ │ main = <coroutine object asyncio_run.<locals>.await_for_given_awaitable at 0x7efeb8cdce40> │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /usr/lib/python3.10/asyncio/base_events.py:649 in run_until_complete │
│ │
│ 646 │ │ if not future.done(): │
│ 647 │ │ │ raise RuntimeError('Event loop stopped before Future completed.') │
│ 648 │ │ │
│ ❱ 649 │ │ return future.result() │
│ 650 │ │
│ 651 │ def stop(self): │
│ 652 │ │ """Stop running the event loop. │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ future = <Task finished name='Task-2' │ │
│ │ coro=<asyncio_run.<locals>.await_for_given_awaitable() done, defined at │ │
│ │ /clive/clive/__private/core/_async.py:22> exception=AssertionError('Beekeeper is │ │
│ │ not initialized')> │ │
│ │ new_task = True │ │
│ │ self = <_UnixSelectorEventLoop running=False closed=True debug=False> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /clive/clive/__private/core/_async.py:23 in await_for_given_awaitable │
│ │
│ 20 │ """ │
│ 21 │ │
│ 22 │ async def await_for_given_awaitable() -> T: │
│ ❱ 23 │ │ return await awaitable │
│ 24 │ │
│ 25 │ return thread_pool.submit(asyncio.run, await_for_given_awaitable()).result() │
│ 26 │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ awaitable = <coroutine object OperationCommon.decorator.<locals>.wrapper.<locals>.impl at │ │
│ │ 0x7efeb8cdcdd0> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /clive/clive/__private/cli/common/operation_common.py:78 in impl │
│ │
│ 75 │ │ │ │ ) as world: │
│ 76 │ │ │ │ │ cls._assert_correct_profile_is_loaded(world.profile_data.name, profi │
│ 77 │ │ │ │ │ ctx.params.update(world=world) │
│ ❱ 78 │ │ │ │ │ await world.commands.activate(password=password) │
│ 79 │ │ │ │ │ await func(ctx, args, *kwargs) │
│ 80 │ │ │ │
│ 81 │ │ │ asyncio_run(impl()) │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ args = () │ │
│ │ beekeeper_remote_endpoint = None │ │
│ │ close_world = <function │ │
│ │ OperationCommon.decorator.<locals>.wrapper.<locals>.impl.<local… │ │
│ │ at 0x7efeb8b26f80> │ │
│ │ cls = <class │ │
│ │ 'clive.__private.cli.common.operation_common.OperationCommon'> │ │
│ │ ctx = <click.core.Context object at 0x7efeb8b44340> │ │
│ │ ExitCallHandler = <class 'clive.__private.core.exit_call_handler.ExitCallHandler'> │ │
│ │ func = <function _main at 0x7efeb8c8cb80> │ │
│ │ kwargs = {'to': 'bob', 'amount': '1.000 HIVE', 'memo': ''} │ │
│ │ password = 'alice' │ │
│ │ profile = 'alice' │ │
│ │ TyperWorld = <class 'clive.__private.core.world.TyperWorld'> │ │
│ │ world = <clive.__private.core.world.TyperWorld object at 0x7efeb8b44ee0> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /clive/clive/__private/core/commands/commands.py:56 in activate │
│ │
│ 53 │ │ return await self.__surround_with_exception_handlers( │
│ 54 │ │ │ Activate( │
│ 55 │ │ │ │ app_state=self._world.app_state, │
│ ❱ 56 │ │ │ │ beekeeper=self._world.beekeeper, │
│ 57 │ │ │ │ wallet=self._world.profile_data.name, │
│ 58 │ │ │ │ password=password, │
│ 59 │ │ │ │ time=time, │
│ │
│ ╭─────────────────────────────────────── locals ────────────────────────────────────────╮ │
│ │ password = 'alice' │ │
│ │ self = <clive.__private.core.commands.commands.Commands object at 0x7efeb8b44f40> │ │
│ │ time = None │ │
│ ╰───────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /clive/clive/__private/core/world.py:74 in beekeeper │
│ │
│ 71 │ │
│ 72 │ @property │
│ 73 │ def beekeeper(self) -> Beekeeper: │
│ ❱ 74 │ │ assert self._beekeeper is not None, "Beekeeper is not initialized" │
│ 75 │ │ return self._beekeeper │
│ 76 │ │
│ 77 │ @property │
│ │
│ ╭──────────────────────────────── locals ─────────────────────────────────╮ │
│ │ self = <clive.__private.core.world.TyperWorld object at 0x7efeb8b44ee0> │ │
│ ╰─────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AssertionError: Beekeeper is not initialized
Edited by Mateusz Żebrak

Merge request reports