-
Notifications
You must be signed in to change notification settings - Fork 217
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
Harden cut command in Snakefiles #5288
base: dev
Are you sure you want to change the base?
Harden cut command in Snakefiles #5288
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving from characters to fields looks okay, but without looking at the input file I cannot say anything about correctness. If this has been tested as working, its okay for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this bug, during my absence! Arthur already told me that it works and it looks good to me. For the LSF case I just don't understand why you used the cut
command with other settings. You probably have a reason, if you let me know I will approve this PR. 😃
@@ -77,13 +77,13 @@ rule simulate: | |||
bsub {input}/tbg/submit.start > simulated/job_id_{params.name}.txt | |||
fi | |||
|
|||
job_id=$(cut -c 6-12 simulated/job_id_{params.name}.txt) | |||
job_id=$(cut -d'<' -f2 simulated/job_id_{params.name}.txt | cut -d'>' -f1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arthur told me, that the cut -d' ' -f4
command worked on hemera. Why did you choose cut -d'<' -f2
here? What is the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -d
sets the delimiter (to whitespace resp. <
/>
in this case) and the -f
selects the "field", i.e., the colum with respect to this delimiter (indexing starts with 1). So, cut -d' ' -f4
means: Split the string with respect to whitespaces and select the fourth field resulting from that.
The LSF version: My best guess was that the output from bsub
is as shown in this stackoverflow answer. The two cut
s split the string into
Full: "Job <930> is submitted to default queue <normal>."
1 ^ 2 ^ 3
First cut: "XXX> ..."
1 ^ 2
Second cut: "XXX"
Could have been a regex but this was faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This seems very reasonable.
The slurm version has been tested on hemera. LSF is untested. |
I wrote the LSF version for the Summit cluster. As far as I know, Summit is now decommissioned and I don't know if any other relevant cluster is using LSF. So testing is difficult. |
Found this bug with Arthur. Hemera just hit the next digit in job ids and these
cut
commands were not up to that challenge. The one for LSF is an educated guess from what the internet says the output should look like. I think I've never run on an LSF cluster.