Skip to content

Commit

Permalink
Merge pull request #101 from esrice/squeue-backwards-compatibility-fix
Browse files Browse the repository at this point in the history
use explicit username instead of --me
  • Loading branch information
percyfal authored Dec 19, 2022
2 parents e40eb02 + a3c5b8a commit a0e559e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions {{cookiecutter.profile_name}}/slurm-sidecar.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
"""Run a Snakemake v7+ sidecar process for Slurm
This sidecar process will poll ``squeue --me --format='%i,%T'`` every 60
seconds by default (use environment variable ``SNAKEMAKE_SLURM_SQUEUE_WAIT``
for adjusting this).
This sidecar process will poll ``squeue --user [user] --format='%i,%T'``
every 60 seconds by default (use environment variable
``SNAKEMAKE_SLURM_SQUEUE_WAIT`` for adjusting this).
Note that you have to adjust the value to fit to your ``MinJobAge`` Slurm
configuration. Jobs remain at least ``MinJobAge`` seconds known to the
Expand Down Expand Up @@ -143,7 +143,7 @@ def _call_squeue(self, allow_failure=True):
"""Run the call to ``squeue``"""
cluster = CookieCutter.get_cluster_option()
try_num = 0
cmd = [SQUEUE_CMD, "--me", "--format=%i,%T", "--state=all"]
cmd = [SQUEUE_CMD, "--user={}".format(os.environ.get("USER")), "--format=%i,%T", "--state=all"]
if cluster:
cmd.append(cluster)
while try_num < self.max_tries:
Expand Down Expand Up @@ -286,8 +286,8 @@ def main():
poll_thread = PollSqueueThread(SQUEUE_WAIT, SQUEUE_CMD, name="poll-squeue")
poll_thread.start()

# Initialize HTTP server that makes available the output of ``squeue --me`` in a
# controlled fashion.
# Initialize HTTP server that makes available the output of ``squeue --user [user]``
# in a controlled fashion.
http_server = JobStateHttpServer(poll_thread)
http_thread = threading.Thread(name="http-server", target=http_server.serve_forever)
http_thread.start()
Expand Down

0 comments on commit a0e559e

Please sign in to comment.