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

Harden cut command in Snakefiles #5288

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

chillenzer
Copy link
Contributor

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.

@chillenzer chillenzer added bug a bug in the project's code component: tools scripts, python libs and CMake component: examples PIConGPU or PMacc examples affects latest release a bug that affects the latest stable release labels Feb 20, 2025
@chillenzer chillenzer added this to the 0.9.0 / next stable milestone Feb 20, 2025
Copy link
Contributor

@ikbuibui ikbuibui left a 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

Copy link
Contributor

@JessicaTiebel JessicaTiebel left a 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)
Copy link
Contributor

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?

Copy link
Contributor Author

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 cuts 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.

Copy link
Contributor

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.

@chillenzer
Copy link
Contributor Author

The slurm version has been tested on hemera. LSF is untested.

@JessicaTiebel
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects latest release a bug that affects the latest stable release bug a bug in the project's code component: examples PIConGPU or PMacc examples component: tools scripts, python libs and CMake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants