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

Use ARRAY_JOB_ID instead of JOB_ID in mail subject #135

Closed
noebi opened this issue Jun 26, 2024 · 3 comments
Closed

Use ARRAY_JOB_ID instead of JOB_ID in mail subject #135

noebi opened this issue Jun 26, 2024 · 3 comments
Assignees
Labels
bug Something isn't working confirmed An issue that has been confirmed to exist
Milestone

Comments

@noebi
Copy link

noebi commented Jun 26, 2024

Hi,
we got reports from confused users who did not really understand why
the mail subject shows a job id for their array job that they've never seen
before and one that's different from the one displayed in the mail body.

Not quite sure why, but in our local setup, task 0 gets a JOB_ID that is equal to
ARRAY_JOB_ID + 1.

So we decided to patch slurm-mail locally to make the subject line use ARRAY_JOB_ID
for array jobs.

Patch:

--- ./src/slurmmail/cli.py.orig 2024-06-12 22:51:04.000000000 +0200
+++ ./src/slurmmail/cli.py      2024-06-26 13:13:50.394081938 +0200
@@ -761,9 +761,14 @@
             subject_state = state
 
         msg = MIMEMultipart("alternative")
-        msg["Subject"] = Template(options.email_subject).substitute(
-            CLUSTER=job.cluster, JOB_ID=job.id, JOB_NAME=job.name, STATE=subject_state
-        )
+        if job.is_array():
+            msg["Subject"] = Template(options.email_subject).substitute(
+                CLUSTER=job.cluster, JOB_ID=job.array_id, JOB_NAME=job.name, STATE=subject_state
+            )
+        else:
+            msg["Subject"] = Template(options.email_subject).substitute(
+                CLUSTER=job.cluster, JOB_ID=job.id, JOB_NAME=job.name, STATE=subject_state
+            )
         msg["To"] = user_email
         msg["From"] = options.email_from_address
         msg["Date"] = email.utils.formatdate(localtime=True)

@neilmunday
Copy link
Owner

Hi,

Thanks for raising this issue. I will take a look soon.

@neilmunday neilmunday added bug Something isn't working confirmed An issue that has been confirmed to exist and removed investigating labels Jul 3, 2024
@neilmunday neilmunday added this to the 4.20 milestone Jul 3, 2024
@neilmunday
Copy link
Owner

Issue fixed in 4.20 branch and will be included in the 4.20 release.

@neilmunday
Copy link
Owner

Version 4.20 released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed An issue that has been confirmed to exist
Projects
None yet
Development

No branches or pull requests

2 participants