Skip to content

fix: unique log names when rerunning dcnum within the same second - #83

Merged
paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:fix-log-name-collision
Nov 23, 2026
Merged

paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:fix-log-name-collision

Conversation

@paulmueller-agent

Copy link
Copy Markdown
Contributor

When dcnum runs on its own output file, the logs of the input file are copied to the output file, including its "dcnum-job-" and "dcnum-log-". The new logs are named with a timestamp at second resolution. If the second run started within the same second as the first, HDF5Writer.store_log raised:

ValueError: Log 'dcnum-job-2026-11-23-10.54.14' already exists in .../out2_output_....rtdc~!

This shows up in scripts and tests that process small files back to back. It was found while verifying the bug hunt, where it made re-runs fail at random.

Fix

Before the job log is written, run_pipeline checks the logs already in the output file. If "dcnum-job-" or "dcnum-log-" exists, a counter is appended to the time string (<time>-1, <time>-2, …), and both new logs use the same suffix so they stay paired. Names do not change when there is no collision.

Tests

  • New test_duplicate_pipeline_same_second fixes time.gmtime, runs the pipeline and then runs it again on its output. It fails on main with the ValueError above. Here it passes, and the output contains both dcnum-job-<time> and dcnum-job-<time>-1 (likewise for "dcnum-log").
  • All 72 tests in tests/test_logic_pipeline.py pass, run one per process locally.
  • flake8 is clean, and ruff shows no new errors.

🤖 Generated with Claude Code

The logs of the input file are copied to the output file. When dcnum
was run on its own output within the same second, the new
"dcnum-job-<time>" and "dcnum-log-<time>" logs had the same names as
the copied ones, and `store_log` raised a `ValueError`. A counter is
now appended to the time string (e.g. "dcnum-job-<time>-1") if
necessary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paulmueller
paulmueller merged commit 6dbc20d into DC-analysis:main Nov 23, 2026
6 checks passed
@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.25%. Comparing base (75b4b5b) to head (dc9c0c3).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   88.19%   88.25%   +0.05%     
==========================================
  Files          63       63              
  Lines        4524     4530       +6     
==========================================
+ Hits         3990     3998       +8     
+ Misses        534      532       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Successfully merging this pull request may close these issues.

2 participants