Closed xapple closed 6 months ago
Just taught a course on a cluster, with a default resp. None-account. Worked like a charm.
So, I wonder, what is the output of sacct -nu $USER -o Account%256
for you?
Here is the output:
(null)
(null)
(null)
(null)
(null)
This pattern repeats for 702 lines.
That is really weird. But I might be able to work with that under the assumption, that is “only” some sort of whitespace.
Just copy-pasted your literal feedback - thank you! - into an editor. It indeed contains a hidden (null)
which is interpreted by Python. If it were just white space (an empty string, the line feeds get stripped away before passed to Python), it would work already.
Now, I wonder: What is this (null)
-character exactly, and why is it produced in the first place? Please run this snippet and attach the resulting file.
#!/usr/bin/env python3
import os
import subprocess
cmd = f'sacct -nu "{os.environ["USER"]}" -o Account%256 | head -n1'
sacct_out = subprocess.check_output(
cmd, shell=True, text=True, stderr=subprocess.PIPE
)
with open('sacct.out', 'wb') as outfile:
outfile.write(sacct_out)
PS What is the output of the locale
command for you?
The string (null)
is "hidden" in the output above because the command specifies the insertion of 256 whitespace characters and right-aligns by default. If one used sacct -nu $USER -o Account%16
it would be easier to read.
The script you provided raises a TypeError, because the file is opened in bytes mode and not text mode. Also the .out
extension is forbidden on GitHub issues uploads. After fixing here is the output attached. A single line with 256 whitespace characters and the string (null)
at the end, as expected.
The script you provided raises a TypeError
My bad, I should have included encode()
. However, please test the code in PR #81 . I am not sure whether it will work for you. Should not break any other code, though.
If it does not work, we need to check more details.
Thanks for looking into this.
I tested this unmerged pull request like this:
conda activate myproj
conda uninstall -y snakemake-executor-plugin-slurm
git clone https://github.com/snakemake/snakemake-executor-plugin-slurm.git
cd snakemake-executor-plugin-slurm
git fetch origin pull/81/head:pr-81
git checkout pr-81
pip install .
And at the end:
pip uninstall snakemake-executor-plugin-slurm
conda install -y snakemake-executor-plugin-slurm
conda deactivate myproj
The result is the following being printed:
No SLURM account given, trying to guess.
Unable to guess SLURM account. Trying to proceed without.
So it worked perfectly 👌🏻
Some SLURM installations don't require specifying an account when using
sbatch
orsalloc
.Currently the value
-A (null)
is actually used in thesbatch
call if you don't mention one:And if you set it to some placeholder value such as "default" for instance, this happens: