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

[simulator util] Ignore error during sim log directory deletion. #1

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion simulator_control/simulator_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def Delete(self):
preexec_fn=os.setpgrp)
# The delete command won't delete the simulator log directory.
if os.path.exists(self.simulator_log_root_dir):
shutil.rmtree(self.simulator_log_root_dir)
shutil.rmtree(self.simulator_log_root_dir, ignore_errors=True)
Copy link

Choose a reason for hiding this comment

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

Does ignore_errors force the directory to be deleted, even if there are errors? Or does this flag simply allow execution to continue, even though the directory may not have been deleted?

Copy link
Author

Choose a reason for hiding this comment

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

Good catch. I think it only ignores the error. This function accepts a onError handler. Do you think if we need to handle it in that way? Or maybe leaving an empty directory is acceptable.

Copy link
Author

Choose a reason for hiding this comment

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

I changed the description to reflect it.

Copy link

@jverkoey jverkoey Aug 1, 2019

Choose a reason for hiding this comment

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

I believe we'll need some sort of equivalent to a rm -f solution.

Copy link

Choose a reason for hiding this comment

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

Might be worth testing a small python script locally to see if ignore_errors works like -f or not.

Copy link
Author

Choose a reason for hiding this comment

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

Good suggestion. I tried to reproduce it locally with a python script and got more data. This issue is not easy to reproduce. The documentation of shutil.rmtree doesn't say that when it would throw "Directory not empty" error. It could be likely caused by race condition mentioned in reframe-hpc/reframe#291.

I found this issue when a Booting simulator solution was used originally for #2, which caused the deletion process to be slow and rmtree can't be finished in time. It doesn't seem to happen for the time being.

I am going to close this PR because ignore_errors is not appropriate to be used under this situation.

self._simulator_id = None

def FetchLogToFile(self, output_file_path, start_time=None, end_time=None):
Expand Down