mjuric / instastart

Speed up startup of Python command-line codes
1 stars 0 forks source link

XDG_RUNTIME_DIR required to use? #1

Open stevenstetzler opened 2 years ago

stevenstetzler commented 2 years ago

I would very much like to use this to speed up LSST stack imports... (And potentially butler CLI commands?) I'm running into an issue running the code after copying.

Traceback (most recent call last):
  File "/gscratch/astro/stevengs/lsst_stacks/stacks/w.2022.06/env/lsst-w.2022.06/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/gscratch/astro/stevengs/lsst_stacks/stacks/w.2022.06/env/lsst-w.2022.06/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/lusers/stevengs/decam_ddf/decam_ddf/processing/sort_files.py", line 1, in <module>
    from ..instastart.auto import start, done
  File "/usr/lusers/stevengs/decam_ddf/decam_ddf/instastart/auto.py", line 1144, in <module>
    _server = _connect_or_serve()
  File "/usr/lusers/stevengs/decam_ddf/decam_ddf/instastart/auto.py", line 1101, in _connect_or_serve
    socket_path = _construct_socket_name()
  File "/usr/lusers/stevengs/decam_ddf/decam_ddf/instastart/auto.py", line 43, in _construct_socket_name
    return os.path.join(os.environ['XDG_RUNTIME_DIR'], f"{fn}.{md5}.socket")
  File "/gscratch/astro/stevengs/lsst_stacks/stacks/w.2022.06/env/lsst-w.2022.06/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'XDG_RUNTIME_DIR'

I see this is already a FIXME in the code: https://github.com/mjuric/instastart/blob/bb7ee781e4d815c6c90612855d282c870dd43379/instastart/auto.py#L42-L43

stevenstetzler commented 2 years ago

Just doing return os.path.join(os.environ.get('XDG_RUNTIME_DIR', "/tmp"), f"{fn}.{md5}.socket") for now