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

fix(cache): handle deleted files when calculating access times (#437) #437

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

mdonadoni
Copy link
Member

@mdonadoni mdonadoni commented Jan 15, 2024

Closes reanahub/reana-job-controller#420

How to test: see related issue

Copy link

codecov bot commented Jan 15, 2024

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (709a685) 37.66% compared to head (4b9bffd) 36.36%.

❗ Current head 4b9bffd differs from pull request most recent head 698900f. Consider uploading reports for the commit 698900f to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #437      +/-   ##
==========================================
- Coverage   37.66%   36.36%   -1.31%     
==========================================
  Files          26       26              
  Lines        1561     1573      +12     
==========================================
- Hits          588      572      -16     
- Misses        973     1001      +28     
Files Coverage Δ
reana_commons/workspace.py 70.00% <71.42%> (-18.81%) ⬇️
reana_commons/utils.py 26.63% <58.33%> (+1.42%) ⬆️

@mdonadoni mdonadoni marked this pull request as ready for review January 15, 2024 14:58
Copy link
Member

@giuseppe-steduto giuseppe-steduto left a comment

Choose a reason for hiding this comment

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

LGTM, and very nicely done!

tmp_path.joinpath("subdir", "b.txt").write_text("content of b")
tmp_path.joinpath("c.txt").symlink_to("a.txt")
tmp_path.joinpath("another_subdir").mkdir()
before_calculating_times = time.time() + 1
Copy link
Member

Choose a reason for hiding this comment

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

Just a very minor note: I found the name of the variable together with the +1 a bit confusing, since because of that +1 it will probably contain a time which is bigger than the time at which the times are calculated (therefore being "after" calculating times).
I guess the goal is checking that the access times are correctly returned and this means that they will need to be "later" then before_writing_files and "earlier" than the moment in which the times are calculated, right? And I guess that the -1 and the +1 are rightly added to account for any potential delays in file system operations.

If so, what about renaming the variable to after_writing_files to remove the ambiguity?
It's in any case a triviality, so feel free to amend it before merging or leave it as is :)

@mdonadoni mdonadoni force-pushed the fix-calc-access-times branch from 4b9bffd to 698900f Compare January 16, 2024 16:44
@mdonadoni mdonadoni changed the title fix(utils): handle deleted files when calculating access times (#437) fix(cache): handle deleted files when calculating access times (#437) Jan 16, 2024
@mdonadoni mdonadoni merged commit 698900f into reanahub:master Jan 16, 2024
15 checks passed
@mdonadoni mdonadoni deleted the fix-calc-access-times branch January 16, 2024 16:52
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.

job-manager: job submission fails with FileNotFoundError
2 participants