From ecd8d0f3200d68540bbd1972076c5ca8e95219f2 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Wed, 13 Aug 2014 14:48:36 -0700 Subject: [PATCH] Add max array task count to job info output --- slurm/slurm.h.in | 1 + src/common/slurm_protocol_pack.c | 4 ++++ src/slurmctld/job_mgr.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in index 08cc1e3e651..a72e77349bd 100644 --- a/slurm/slurm.h.in +++ b/slurm/slurm.h.in @@ -1239,6 +1239,7 @@ typedef struct job_info { void *array_bitmap; /* NOTE: set on unpack */ uint32_t array_job_id; /* job_id of a job array or 0 if N/A */ uint32_t array_task_id; /* task_id of a job array */ + uint32_t array_max_tasks; /* Maximum number of running tasks */ char *array_task_str; /* string expression of task IDs in this record */ uint32_t assoc_id; /* association id for job */ uint16_t batch_flag; /* 1 if batch: queued job with script */ diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index 2d0367b54ba..f1a81342d8b 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -4714,6 +4714,9 @@ static void _xlate_task_str(job_info_t *job_ptr) } } + if (job_ptr->array_max_tasks) + xstrfmtcat(out_buf, "%c%u", '%', job_ptr->array_max_tasks); + xfree(job_ptr->array_task_str); job_ptr->array_task_str = out_buf; } @@ -4743,6 +4746,7 @@ _unpack_job_info_members(job_info_t * job, Buf buffer, * to be converted to human readable form by the client. */ safe_unpackstr_xmalloc(&job->array_task_str, &uint32_tmp, buffer); + safe_unpack32(&job->array_max_tasks, buffer); _xlate_task_str(job); safe_unpack32(&job->assoc_id, buffer); diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 21178fd8f92..432444fc692 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -7241,8 +7241,10 @@ void pack_job(struct job_record *dump_job_ptr, uint16_t show_flags, Buf buffer, if (dump_job_ptr->array_recs) { _build_array_str(dump_job_ptr->array_recs); packstr(dump_job_ptr->array_recs->task_id_str, buffer); + pack32(dump_job_ptr->array_recs->max_run_tasks, buffer); } else { packnull(buffer); + pack32((uint32_t) 0, buffer); } pack32(dump_job_ptr->assoc_id, buffer); pack32(dump_job_ptr->job_id, buffer); -- GitLab