Hello,

I am working on trying to get better information on how jobs are being scheduled by the backfill algorithm. And have started with the attached patch to expose information to squeue that is already calculated by the scheduler. Since it breaks the ABI for messages from the controller, I don't expect that this would be merged in the nearterm, but is there any interest at some point to have this available? Also, I would appreciate some feedback on whether I'm doing the memory management correctly. It wasn't clear to me exactly where memory should be freed.

Thanks

Martins
--- ./slurm/slurm.h.in.orig     2014-04-03 19:37:04.000000000 +0000
+++ ./slurm/slurm.h.in  2014-04-03 19:38:16.000000000 +0000
@@ -1220,6 +1220,7 @@
        char *name;             /* name of the job */
        char *network;          /* network specification */
        char *nodes;            /* list of nodes allocated to job */
+       char *sched_nodes;      /* list of nodes scheduled to be used for job */
        uint16_t nice;          /* requested priority change */
        int32_t *node_inx;              /* list index pairs into node_table for 
*nodes:
                                 * start_range_1, end_range_1,
--- ./src/common/slurm_protocol_defs.c.orig     2014-04-03 19:48:05.000000000 
+0000
+++ ./src/common/slurm_protocol_defs.c  2014-04-03 19:48:35.000000000 +0000
@@ -541,6 +541,7 @@
                xfree(job->network);
                xfree(job->node_inx);
                xfree(job->nodes);
+               xfree(job->sched_nodes);
                xfree(job->partition);
                xfree(job->qos);
                xfree(job->req_node_inx);
--- ./src/common/slurm_protocol_pack.c.orig     2014-04-03 19:46:37.000000000 
+0000
+++ ./src/common/slurm_protocol_pack.c  2014-04-03 20:59:15.000000000 +0000
@@ -4695,6 +4695,7 @@
                safe_unpack_time(&job->preempt_time, buffer);
                safe_unpack32(&job->priority, buffer);
                safe_unpackstr_xmalloc(&job->nodes, &uint32_tmp, buffer);
+               safe_unpackstr_xmalloc(&job->sched_nodes, &uint32_tmp, buffer);
                safe_unpackstr_xmalloc(&job->partition, &uint32_tmp, buffer);
                safe_unpackstr_xmalloc(&job->account, &uint32_tmp, buffer);
                safe_unpackstr_xmalloc(&job->network, &uint32_tmp, buffer);
--- ./src/plugins/sched/backfill/backfill.c.orig        2014-04-03 
19:50:22.000000000 +0000
+++ ./src/plugins/sched/backfill/backfill.c     2014-04-03 19:52:15.000000000 
+0000
@@ -1076,6 +1076,8 @@
                reject_array_job_id = 0;
                if (debug_flags & DEBUG_FLAG_BACKFILL)
                        _dump_job_sched(job_ptr, end_reserve, avail_bitmap);
+               xfree(job_ptr->sched_nodes);
+               job_ptr->sched_nodes = bitmap2node_name(avail_bitmap);
                bit_not(avail_bitmap);
                _add_reservation(job_ptr->start_time, end_reserve,
                                 avail_bitmap, node_space, &node_space_recs);
--- ./src/slurmctld/job_mgr.c.orig      2014-04-03 19:39:04.000000000 +0000
+++ ./src/slurmctld/job_mgr.c   2014-04-03 20:57:40.000000000 +0000
@@ -6108,6 +6108,7 @@
        FREE_NULL_BITMAP(job_ptr->node_bitmap);
        FREE_NULL_BITMAP(job_ptr->node_bitmap_cg);
        xfree(job_ptr->nodes);
+       xfree(job_ptr->sched_nodes);
        xfree(job_ptr->nodes_completing);
        xfree(job_ptr->partition);
        FREE_NULL_LIST(job_ptr->part_ptr_list);
@@ -6441,6 +6442,9 @@
                        xfree(nodelist);
                }
 
+               /* Should this only be for PD jobs? */
+               packstr(dump_job_ptr->sched_nodes, buffer);
+
                if (!IS_JOB_PENDING(dump_job_ptr) && dump_job_ptr->part_ptr)
                        packstr(dump_job_ptr->part_ptr->name, buffer);
                else
--- ./src/slurmctld/slurmctld.h.orig    2014-04-03 21:00:21.000000000 +0000
+++ ./src/slurmctld/slurmctld.h 2014-04-03 21:01:32.000000000 +0000
@@ -582,6 +582,7 @@
        char *network;                  /* network/switch requirement spec */
        uint32_t next_step_id;          /* next step id to be used */
        char *nodes;                    /* list of nodes allocated to job */
+       char *sched_nodes;              /* list of nodes scheduled for job */
        slurm_addr_t *node_addr;        /* addresses of the nodes allocated to
                                         * job */
        bitstr_t *node_bitmap;          /* bitmap of nodes allocated to job */
--- ./src/squeue/opts.c.submit  2014-04-02 19:58:23.000000000 +0000
+++ ./src/squeue/opts.c 2014-04-03 20:35:07.000000000 +0000
@@ -808,6 +808,10 @@
                                                          field_size,
                                                          right_justify,
                                                          suffix );
+                       else if (field[0] == 'Y')
+                               job_format_add_schednodes( params.format_list,
+                                                     field_size,
+                                                     right_justify, suffix );
                        else if (field[0] == 'z')
                                job_format_add_num_sct( params.format_list,
                                                           field_size,
--- ./src/squeue/print.c.submit 2014-04-02 19:58:33.000000000 +0000
+++ ./src/squeue/print.c        2014-04-03 20:33:34.000000000 +0000
@@ -778,6 +778,24 @@
        return SLURM_SUCCESS;
 }
 
+int _print_job_schednodes(job_info_t * job, int width, bool right, char* 
suffix)
+{
+        if (job == NULL) {       /* Print the Header instead */
+                char *title = "SCHEDNODES";
+                if (params.cluster_flags & CLUSTER_FLAG_BG)
+                        title = "MIDPLANELIST";
+                _print_str(title, width, right, false);
+        } else {
+                char *nodes = xstrdup(job->sched_nodes);
+                _print_nodes(nodes, width, right, false);
+                xfree(nodes);
+        }
+
+        if (suffix)
+                printf("%s", suffix);
+        return SLURM_SUCCESS;
+}
+
 int _print_job_reason_list(job_info_t * job, int width, bool right,
                char* suffix)
 {
--- ./src/squeue/print.h.submit 2014-04-02 19:58:41.000000000 +0000
+++ ./src/squeue/print.h        2014-04-03 20:31:24.000000000 +0000
@@ -141,6 +141,8 @@
        job_format_add_function(list,wid,right,suffix,_print_job_priority_long)
 #define job_format_add_nodes(list,wid,right,suffix) \
        job_format_add_function(list,wid,right,suffix,_print_job_nodes)
+#define job_format_add_schednodes(list,wid,right,suffix) \
+       job_format_add_function(list,wid,right,suffix,_print_job_schednodes)
 #define job_format_add_node_inx(list,wid,right,suffix) \
        job_format_add_function(list,wid,right,suffix,_print_job_node_inx)
 #define job_format_add_num_cpus(list,wid,right,suffix) \
@@ -254,6 +256,8 @@
                        char* suffix);
 int _print_job_nodes(job_info_t * job, int width, bool right_justify,
                        char* suffix);
+int _print_job_schednodes(job_info_t * job, int width, bool right_justify,
+                       char* suffix);
 int _print_job_node_inx(job_info_t * job, int width, bool right_justify,
                        char* suffix);
 int _print_job_partition(job_info_t * job, int width, bool right_justify,

Reply via email to