Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run wdls in a loop when importing miniwdl as a python package #718

Open
giuliovn opened this issue Nov 19, 2024 · 0 comments
Open

Comments

@giuliovn
Copy link

When importing from WDL.CLI import runner and running wdl workflows as part of a python script in a loop, the second workflow can't start because of this error:

Traceback (most recent call last):
  File "/home/giulio/proj/ultima/mario/main.py", line 33, in <module>
    main(WDL_PATH, INPUTS)
  File "/home/giulio/proj/ultima/mario/main.py", line 16, in main
    out = wdl_run(
          ^^^^^^^^
  File "/home/giulio/proj/ultima/mario/.venv/lib/python3.12/site-packages/WDL/CLI.py", line 660, in runner
    set_status = cleanup.enter_context(configure_logger(json=log_json))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/giulio/.local/share/uv/python/cpython-3.12.3-linux-x86_64-gnu/lib/python3.12/contextlib.py", line 526, in enter_context
    result = _enter(cm)
             ^^^^^^^^^^
  File "/home/giulio/.local/share/uv/python/cpython-3.12.3-linux-x86_64-gnu/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/giulio/proj/ultima/mario/.venv/lib/python3.12/site-packages/WDL/_util.py", line 432, in configure_logger
    coloredlogs.install(
  File "/home/giulio/proj/ultima/mario/.venv/lib/python3.12/site-packages/coloredlogs/__init__.py", line 457, in install
    handler = StandardErrorHandler()
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/giulio/proj/ultima/mario/.venv/lib/python3.12/site-packages/WDL/_util.py", line 374, in __init__
    assert not self.__class__._singleton
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

If I remove the assertion assert not self.__class__._singleton everything seems to work fine, but I guess it is there for a reason.
The weirdest thing is that an equivalent setup worked until 2 weeks ago (I see the last instance ran 2024-11-08), and I can't spot any difference in the code, python interpreter and dependencies versions.

To reproduce

  1. Clone https://github.com/giuliovn/mario.
  2. Make sure commit 5b5d819a99b01429cb967199b128ecd5b455be3e is checked out
  3. Follow the instruction in the repo's README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant