Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Potential for SLURMCluster log directory creation failing

未关闭
#692 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python

调研方向

从 dask_jobqueue/core.py 中 issue 链接所指的构造函数位置附近对 log_directory 的处理开始,并将其与所描述的并发 SLURMCluster 构造进行比较。检查当另一个 workflow 先创建路径时,目录创建的行为。完成标准是并发 workflow 可以使用同一个已存在的日志目录,而不会引发 FileExistsError。

由索引模型根据 Issue 内容生成。

描述

bug

Describe the issue:

I am using dask_jobqueue.SLURMCluster in my workflows. I am running ~15 workflows at a time. I am getting unlucky and it seems like two separate workflows are both trying to create the output log directory. One would fail:

  File "/datasets/work/jones-storage/work/miniconda/miniforge3/envs/flint_main/lib/python3.12/site-packages/dask_jobqueue/core.py", line 661, in __init__
    self._dummy_job  # trigger property to ensure that the job is valid
    ^^^^^^^^^^^^^^^
  File "/datasets/work/jones-storage/work/miniconda/miniforge3/envs/flint_main/lib/python3.12/site-packages/dask_jobqueue/core.py", line 690, in _dummy_job
    return self.job_cls(
           ^^^^^^^^^^^^^
  File "/datasets/work/jones-storage/work/miniconda/miniforge3/envs/flint_main/lib/python3.12/site-packages/dask_jobqueue/slurm.py", line 37, in __init__
    super().__init__(
  File "/datasets/work/jones-storage/work/miniconda/miniforge3/envs/flint_main/lib/python3.12/site-packages/dask_jobqueue/core.py", line 375, in __init__
    os.makedirs(self.log_directory)
  File "<frozen os>", line 225, in makedirs
FileExistsError: [Errno 17] File exists: 'flint_logs'

Minimal Complete Verifiable Example:

Given the 'race condition' involved I am not able to give a concise single example. I am guessing that it is a case that the two workflows are both getting past:

https://github.com/dask/dask-jobqueue/blob/d562e6c8c0560f8ab84d12edb70726f536fd551f/dask_jobqueue/core.py#L379

and subsequently only one is successfully able to make the directory.

Would it make sense to use Pathlib.Path here? Something like

if self.log_directory:
    log_path = Path(self.log_directory)
    log_path.mkdir(exists_ok=True, parent=True)

Anything else we need to know?:

Environment:

  • Dask version:
  • Python version: Python 3.12.8
  • Operating System: SLES 15.5
  • Install method (conda, pip, source): pip
  • dask_jobqueue: 0.9.0
主要语言
Python
星标
256
派生
149
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

dask/dask-jobqueue 的其他 Issue

查看 dask/dask-jobqueue 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。