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

Write output from submission to file on error #124

Merged
merged 1 commit into from
Oct 13, 2022
Merged
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
4 changes: 3 additions & 1 deletion pysqa/utils/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ def _execute_command(
universal_newlines=True,
shell=not isinstance(commands, list),
)
except subprocess.CalledProcessError:
except subprocess.CalledProcessError as e:
with open(os.path.join(working_directory, "pysqa.err"), "w") as f:
Copy link
Member

Choose a reason for hiding this comment

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

Should it be a write or an append? And should we name the file pysqa.log instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My assumption was that in each directory pysqa only submits one job. If that's not true we should probably use propper logging. I have no opinion on the filename though, I can change that.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, you are right - the file should only be written once. And naming the file pysqa.err is also fine for me.

print(e.stdout, file=f)
out = None
if out is not None and split_output:
return out.split("\n")
Expand Down