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 s3 file cache sharing temp folder across processes #1650

Merged
2 commits merged into from
May 24, 2022
Merged

Conversation

ghost
Copy link

@ghost ghost commented May 22, 2022

close #1633

@ghost ghost self-requested a review May 22, 2022 03:27
@codecov
Copy link

codecov bot commented May 22, 2022

Codecov Report

Merging #1650 (fb5fdfa) into master (c7d7d39) will decrease coverage by 0.01%.
The diff coverage is n/a.

❗ Current head fb5fdfa differs from pull request most recent head 8f1de86. Consider uploading reports for the commit 8f1de86 to get more accurate results

@@            Coverage Diff             @@
##           master    #1650      +/-   ##
==========================================
- Coverage   77.83%   77.81%   -0.02%     
==========================================
  Files         232      232              
  Lines       18209    18219      +10     
==========================================
+ Hits        14173    14178       +5     
- Misses       4036     4041       +5     
Impacted Files Coverage Δ
lib/cosmos/microservices/reducer_microservice.rb 91.39% <0.00%> (-1.23%) ⬇️
lib/cosmos/utilities/s3_file_cache.rb 22.97% <0.00%> (+0.05%) ⬆️
lib/cosmos/utilities/metric.rb 90.19% <0.00%> (+0.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7d7d39...8f1de86. Read the comment docs.

Logger.error("Reducer Error: #{filename}:#{File.size(filename)} bytes: \n#{e.formatted}")
else
Logger.error("Reducer Error: #{filename}:(Does Not Exist): \n#{e.formatted}")
end
Copy link

Choose a reason for hiding this comment

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

Is this what you expect is happening with the reducer error?

Copy link
Author

Choose a reason for hiding this comment

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

Not sure what this comment means, but this error code is buggy and I need to fix it.

FileUtils.mkdir_p(@cache_dir)
at_exit do
FileUtils.remove_dir(@cache_dir, true)
end
Copy link

Choose a reason for hiding this comment

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

I assume the at_exit applies to the Thread you create below?

Copy link
Author

Choose a reason for hiding this comment

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

At exit applies to the entire ruby process.

FileUtils.mkdir_p(@cache_dir)
at_exit do
FileUtils.remove_dir(@cache_dir, true)
end

# Clear out local file cache
FileUtils.rm_f Dir.glob("#{@cache_dir}/*")
Copy link

Choose a reason for hiding this comment

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

Probably don't need to do this if you're dynamically creating a new dir above

Copy link
Author

@ghost ghost May 23, 2022

Choose a reason for hiding this comment

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

good catch

file.retrieve
rescue
# Will be automatically retried
end
Copy link

Choose a reason for hiding this comment

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

What's the point of raising the error and then silently rescuing and retrying?

Copy link
Author

Choose a reason for hiding this comment

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

The error didn't use to be there, but I added it for when using retrieve by itself

@ghost ghost merged commit fed55ee into master May 24, 2022
@ghost ghost deleted the fix_s3_file_cache branch May 24, 2022 04:09
This pull request was closed.
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.

Reducer Errors when using loadsim target with default settings
1 participant