pikers / piker

(e2e) foss trading for non-tinas
GNU Affero General Public License v3.0
103 stars 17 forks source link

Daemon crashes if ~/.config/piker/marketshare folder isn't present #428

Closed jaredgoldman closed 1 year ago

jaredgoldman commented 1 year ago

When attempting to run the pikerd --tsdb on a fresh install, the daemon fails as the ~/.config/piker/marketstore folder is not created automatically. We should add this on boot if the folder is not present. Fat stacks:

Traceback (most recent call last):
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/bin/pikerd", line 33, in <module>
    sys.exit(load_entry_point('piker', 'console_scripts', 'pikerd')())
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/algorandpa/dev/repos/piker/piker/cli/__init__.py", line 115, in pikerd
    trio.run(main)
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/lib/python3.10/site-packages/trio/_core/_run.py", line 2010, in run
    raise runner.main_task_outcome.error
  File "/home/algorandpa/dev/repos/piker/piker/cli/__init__.py", line 100, in main
    ctn_ready, config, (cid, pid) = await n.start(
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/lib/python3.10/site-packages/trio/_core/_run.py", line 1085, in start
    async with open_nursery() as old_nursery:
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/lib/python3.10/site-packages/trio/_core/_run.py", line 850, in __aexit__
    raise combined_error_from_nursery
  File "/home/algorandpa/dev/repos/piker/piker/data/_ahab.py", line 379, in start_ahab
    async with portal.open_context(
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/lib/python3.10/site-packages/async_generator/_util.py", line 34, in __aenter__
    return await self._agen.asend(None)
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/src/tractor/tractor/_portal.py", line 419, in open_context
    raise unpack_error(msg, self.channel) from None
tractor._exceptions.RemoteActorError: ('marketstored', '5a8d6a72-0dc1-448a-804b-63d28c2e3420')
Traceback (most recent call last):
  File "/home/algorandpa/dev/repos/piker/py-3.10.8/src/tractor/tractor/_runtime.py", line 196, in _invoke
    res = await coro
  File "/home/algorandpa/dev/repos/piker/piker/data/_ahab.py", line 305, in open_ahabd
    ) = ep_func(client)
  File "/home/algorandpa/dev/repos/piker/piker/data/marketstore.py", line 137, in start_marketstore
    os.mkdir(mktsdir)
FileNotFoundError: [Errno 2] No such file or directory: '/home/algorandpa/.config/piker/marketstore'
algorandpa commented 1 year ago

@goodboy I don't actually think this is an issue, it only happens when pikerd is ran without a .config/piker file. Should we create this in marketstore.py or check for the files existance higher up the call stack? Maybe in open_pikerd?