Skip to content

Race condition for daily warning? #2530

@Zethson

Description

@Zethson

Describe the bug

tests/tools/_coda/test_sccoda.py:3: in <module>
    import arviz as az
../../../.local/share/hatch/env/virtual/pertpy/xQQBcIEI/hatch-test.py3.12/lib/python3.12/site-packages/arviz/__init__.py:61: in <module>
    _warn_once_per_day()
../../../.local/share/hatch/env/virtual/pertpy/xQQBcIEI/hatch-test.py3.12/lib/python3.12/site-packages/arviz/__init__.py:58: in _warn_once_per_day
    _atomic_write_text(stamp_file, today.isoformat())
../../../.local/share/hatch/env/virtual/pertpy/xQQBcIEI/hatch-test.py3.12/lib/python3.12/site-packages/arviz/__init__.py:36: in _atomic_write_text
    tmp.replace(path)
/usr/lib/python3.12/pathlib.py:1378: in replace
    os.replace(self, target)
E   FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/.cache/arviz/daily_warning.tmp' -> '/home/runner/.cache/arviz/daily_warning'

Expected behaviour

I would expect such a required folder to be silently created

Steps to reproduce

I have a CI setup where I run pytest with parallel workers. Up until recently, this was all fine but as of a few days or very few weeks ago, my CI regularly fails with the above message. My best guess is that there's a race condition going on.

I think the folder should always be properly created or something else is likely wrong with how the warning works.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions