Skip to content

Commit 38fa919

Browse files
fix: sshare testing as an alternative to sacctmgr account tests (#178)
Addresses issue #177 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Enhanced error handling in account validation for SLURM, providing more informative error messages. - Implemented a fallback mechanism to verify SLURM account validity through an additional command. - **Chores** - Updated the authorization token in the GitHub Actions workflow for posting to Mastodon. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
1 parent 4f5e921 commit 38fa919

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/workflows/post_to_mastodon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
timeout_minutes: 2
2222
max_attempts: 3
2323
command: |
24-
curl -X POST -H "Authorization: Bearer ${{ secrets.MASTODON_ACCESS_TOKEN }}" \
24+
curl -X POST -H "Authorization: Bearer ${{ secrets.MASTODONBOT }}" \
2525
-F "status=New release in Snakemake project '${{ github.event.repository.full_name }}' for pull request '#${{ github.event.pull_request.number }}' merged: '${{ github.event.pull_request.title }}'. Get the latest release from #Bioconda or #Pypi." \
2626
https://fediscience.org/api/v1/statuses \
2727
-w "\nResponse code: %{http_code}\n" \

snakemake_executor_plugin_slurm/__init__.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,24 @@ def test_account(self, account):
633633
cmd, shell=True, text=True, stderr=subprocess.PIPE
634634
)
635635
except subprocess.CalledProcessError as e:
636-
raise WorkflowError(
637-
f"Unable to test the validity of the given or guessed SLURM account "
638-
f"'{account}' with sacctmgr: {e.stderr}"
636+
sacctmgr_report = (
637+
"Unable to test the validity of the given or guessed "
638+
f"SLURM account '{account}' with sacctmgr: {e.stderr}."
639639
)
640+
try:
641+
cmd = "sshare -U --format Account --noheader"
642+
accounts = subprocess.check_output(
643+
cmd, shell=True, text=True, stderr=subprocess.PIPE
644+
)
645+
except subprocess.CalledProcessError as e2:
646+
sshare_report = (
647+
"Unable to test the validity of the given or guessed"
648+
f" SLURM account '{account}' with sshare: {e2.stderr}."
649+
)
650+
raise WorkflowError(
651+
f"The 'sacctmgr' reported: '{sacctmgr_report}' "
652+
f"and likewise 'sshare' reported: '{sshare_report}'."
653+
)
640654

641655
# The set() has been introduced during review to eliminate
642656
# duplicates. They are not harmful, but disturbing to read.

0 commit comments

Comments
 (0)