Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AlecThomson
Copy link
Owner

Test to ensure unique name for holography file when copied.

Also fixes hard-coded catalogue name (whoops)

@AlecThomson AlecThomson requested a review from Copilot April 1, 2025 11:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request addresses a race condition by ensuring unique holography file names when copied and fixes a hard-coded catalogue name.

  • Unique file name generation in linmos.py using a UUID.
  • Dynamic assignment of the catalogue name in makecat.py based on the output file.
  • Minor import ordering updates in fitsutils.py and frion.py.
  • Bumped versions in the pre-commit configuration to align with updated tooling.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
arrakis/utils/fitsutils.py Reordered FRion import to consolidate dependencies.
arrakis/makecat.py Updated catalogue name assignment based on outfile input.
arrakis/linmos.py Introduced unique filename generation using a UUID for holography files.
arrakis/frion.py Adjusted FRion import ordering for consistency.
.pre-commit-config.yaml Upgraded pre-commit hook revisions and removed the typos hook.
Comments suppressed due to low confidence (2)

arrakis/linmos.py:210

  • [nitpick] Consider using uuid.uuid4() instead of uuid.uuid1() to generate a non-predictable unique file name, which may better address the race condition.
holofile_name = str(uuid.uuid1()) + ".fits"

.pre-commit-config.yaml:36

  • [nitpick] The removal of the typos hook might reduce automated spelling checks; please confirm that this removal is intentional.
repo: https://github.com/crate-ci/typos

@AlecThomson AlecThomson marked this pull request as ready for review April 8, 2025 01:45
@AlecThomson
Copy link
Owner Author

After revisiting with is @tjgalvin, we recalled why we added this in the first place. It turns out that the fundamental issue (hammering a lustre file server) was not actually addressed by moving the holography file. Its weird that I never encountered race conditions in my own usage, but was good at least to bring out this lurking bug.

I've decided to remove the offending section. Less code is more code. This also places the responsibility for disk usage and management on the user and environment - not in Arrakis.

@AlecThomson AlecThomson requested a review from Copilot April 8, 2025 01:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

arrakis/makecat.py:1149

  • Assigning catalogue_name to None when outfile is not provided might lead to unexpected behavior if downstream code expects a string. Consider using a default string value instead of None.
        catalogue_name = None

arrakis/linmos.py:203

  • The removal of the file copying logic may affect downstream code that expects the holography file to be available in MEMDIR. Please verify that holofile remains accessible at its referenced location.
            copyfile(holofile, holo_copy)

.pre-commit-config.yaml:36

  • The removal of the typos pre-commit hook may reduce automatic detection of typographical errors. Confirm this removal is intentional and that other mechanisms are in place to catch such mistakes.
   -    rev: v1.29.10

@AlecThomson AlecThomson merged commit e8d4501 into master Apr 8, 2025
3 checks passed
@AlecThomson AlecThomson deleted the race-fix branch April 8, 2025 01:50
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