能否使用sacct --name通过作业名称前缀查询作业?
sacct --name Yes, you absolutely can query jobs using a name prefix with sacct --name—you just need to adjust how you use wildcards so Slurm, not your shell, interprets them. Here's how to fix it:
The Problem with Your Initial Attempt
When you ran sacct --name Qm*, your shell tried to expand Qm* to match files in your current directory first. If there were no matching files, it passed the literal string Qm* to sacct, which treats * as a regular character (not a wildcard). That's why you got empty results.
Solution 1: Use Quotes to Let Slurm Handle the Wildcard
Modern Slurm versions support the * wildcard in the --name parameter. The key is to wrap your pattern in quotes to prevent your shell from expanding it prematurely. For your prefix example, run:
sacct --name "Qm*"
This passes the exact Qm* pattern to sacct, which will then match any job name starting with Qm.
Solution 2: Legacy Wildcard (if * Doesn't Work)
If you're using an older Slurm version, it might use % instead of * as the wildcard character for job name matching. Try this instead:
sacct --name "Qm%"
Bonus: Match Multiple Prefixes
You can also query multiple prefixes at once by using a comma-separated list inside the quotes:
sacct --name "Qm*,Abc*,Xyz*"
Example Verification
Using your existing job name QmRsaBEGcqxQcJbBxCi1LN9iz5bDAGDWR6Hx7ZvWqgqmdR*1*0*-1.sh (where the * are part of the actual job name), the quoted Qm* pattern will correctly match this job, just like your full-name query did.
内容的提问来源于stack exchange,提问作者alper

