Hey Mark, yes this is the correct way of doing this (you should probably use
xstrdup instead of strdup though). As you
will noticed the state_desc string is not set anywhere in the controller. I
think the original plan was to xstrdup the
debug message there into that field but that has yet to happen.
Danny
On Tuesday June 28 2011 4:35:32 PM Mark Nelson wrote:
> Hi there,
>
> I was just having a look at the accounting policy code in slurmctld
> and I was wondering what the correct way of setting the state
> descriiption string for a job is. In this case for a job running
> against an association that has exceeded its GrpCPUMin limit (we're
> running with hard limits in place with quarterly quota amounts). I'd
> like to set a state description of "QuotaExceeded" as that's a lot
> more familiar to our users than "AssociationJobLimit".
>
> Is the following patch correct?
>
> Thanks!
> Mark
>
> ---
> src/slurmctld/acct_policy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: slurm-2.2.7/src/slurmctld/acct_policy.c
> ===================================================================
> --- slurm-2.2.7.orig/src/slurmctld/acct_policy.c
> +++ slurm-2.2.7/src/slurmctld/acct_policy.c
> @@ -1063,7 +1063,7 @@ extern bool acct_policy_job_runnable(str
> && (assoc_ptr->grp_cpu_mins != (uint64_t)INFINITE)
> && (usage_mins >= assoc_ptr->grp_cpu_mins)) {
> job_ptr->state_reason = WAIT_ASSOC_JOB_LIMIT;
> - xfree(job_ptr->state_desc);
> + job_ptr->state_desc = strdup("QuotaExceeded");
> debug2("job %u being held, "
> "assoc %u is at or exceeds "
> "group max cpu minutes limit %"PRIu64" "