From 297a13ce54e8cbaa92921a08fb22ef1bb0110e5c Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 12 Sep 2005 21:09:36 +0000 Subject: [PATCH] Added logic to return scheduled nodes to Maui scheduler (David Jackson, Cluster Resources) --- NEWS | 2 + .../sched/maui/wiki/wiki_canceljob.cpp | 2 +- src/plugins/sched/maui/wiki/wiki_request.cpp | 4 +- src/plugins/sched/maui/wiki/wiki_startjob.cpp | 14 ++++++- src/plugins/sched/maui/wiki/wiki_status.cpp | 2 + src/slurmctld/sched_plugin.h | 1 + src/slurmctld/sched_upcalls.c | 37 +++++++++++++++++++ 7 files changed, 58 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 1aa8719316a..aa880bb5a52 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ documents those changes that are of interest to users and admins. add string length checking. -- Modify orphan batch job time calculation for BGL to account for slowness when booting many bglblocks at the same time. + -- Added logic to return scheduled nodes to Maui scheduler (David + Jackson, Cluster Resources) * Changes in SLURM 0.6.0-pre4 ============================= diff --git a/src/plugins/sched/maui/wiki/wiki_canceljob.cpp b/src/plugins/sched/maui/wiki/wiki_canceljob.cpp index e84165a0866..9a87f0d79cc 100644 --- a/src/plugins/sched/maui/wiki/wiki_canceljob.cpp +++ b/src/plugins/sched/maui/wiki/wiki_canceljob.cpp @@ -73,5 +73,5 @@ wiki_canceljob_t::action( void ) u_int32_t id = (u_int32_t) atol( m_jobid ); verbose( "Wiki canceling job %s", m_jobid ); return new wiki_status_t( ( sched_cancel_job( id ) - == SLURM_SUCCESS ) ? 0 : 1 ); + == SLURM_SUCCESS ) ? 0 : -1 ); } diff --git a/src/plugins/sched/maui/wiki/wiki_request.cpp b/src/plugins/sched/maui/wiki/wiki_request.cpp index 70a1af81ea4..7bf14331e10 100644 --- a/src/plugins/sched/maui/wiki/wiki_request.cpp +++ b/src/plugins/sched/maui/wiki/wiki_request.cpp @@ -521,6 +521,7 @@ wiki_getjobs_t::wiki_getjobs_t( char *data, size_t len ) : // JOB_FIELD_END_TIME, -- this confuses Maui JOB_FIELD_USER_ID, JOB_FIELD_GROUP_ID, + JOB_FIELD_ALLOC_NODES, JOB_FIELD_REQ_NODES, JOB_FIELD_PARTITION, JOB_FIELD_MIN_NODES, @@ -546,6 +547,7 @@ wiki_getjobs_t::wiki_getjobs_t( char *data, size_t len ) : { "UNAME", JOB_FIELD_USER_ID }, { "GNAME", JOB_FIELD_GROUP_ID }, { "HOSTLIST", JOB_FIELD_REQ_NODES }, + { "TASKLIST", JOB_FIELD_ALLOC_NODES }, { "PARTITIONMASK", JOB_FIELD_PARTITION }, { "NODES", JOB_FIELD_MIN_NODES }, { "RMEM", JOB_FIELD_MIN_MEMORY }, @@ -574,7 +576,7 @@ wiki_getjobs_t::map_enum( char * const field, static struct string_map job_state_map[] = { { JOB_STATE_LABEL_PENDING, "Idle" }, { JOB_STATE_LABEL_RUNNING, "Running" }, - { JOB_STATE_LABEL_COMPLETE, "Complete" }, + { JOB_STATE_LABEL_COMPLETE, "Completed" }, { JOB_STATE_LABEL_FAILED, "Removed" }, { JOB_STATE_LABEL_TIMEOUT, "Removed" }, { JOB_STATE_LABEL_NODE_FAIL, "Removed" }, diff --git a/src/plugins/sched/maui/wiki/wiki_startjob.cpp b/src/plugins/sched/maui/wiki/wiki_startjob.cpp index 94f6f735b0f..81e057c1195 100644 --- a/src/plugins/sched/maui/wiki/wiki_startjob.cpp +++ b/src/plugins/sched/maui/wiki/wiki_startjob.cpp @@ -68,6 +68,7 @@ message_t * wiki_startjob_t::action( void ) { u_int32_t id = (u_int32_t) atol( m_jobid ); + int rc; // * // If Maui has specified a node list to run on, change the @@ -95,6 +96,15 @@ wiki_startjob_t::action( void ) } verbose( "Wiki starting job %s", m_jobid ); - return new wiki_status_t( (sched_start_job( id, (u_int32_t) 1 ) - == SLURM_SUCCESS ) ? : 0 -1 ); + + rc = sched_start_job( id, (u_int32_t) 1 ); + + if (rc == SLURM_SUCCESS) + { + return new wiki_status_t( 0, "SUCCESS: job %s started successfully"); + } + else + { + return new wiki_status_t( -1, "ERROR: job %s failed to start"); + } } diff --git a/src/plugins/sched/maui/wiki/wiki_status.cpp b/src/plugins/sched/maui/wiki/wiki_status.cpp index 865fd6e4708..04e72ec0f7e 100644 --- a/src/plugins/sched/maui/wiki/wiki_status.cpp +++ b/src/plugins/sched/maui/wiki/wiki_status.cpp @@ -52,6 +52,8 @@ wiki_status_t::wiki_status_t( int status, char * const msg ) : m_str += " RESPONSE="; m_str += msg; } + + debug3( "Wiki plugin status = \"%s\"", m_str.s() ); } // ************************************************************** diff --git a/src/slurmctld/sched_plugin.h b/src/slurmctld/sched_plugin.h index d0d29645d17..f918a9ce196 100644 --- a/src/slurmctld/sched_plugin.h +++ b/src/slurmctld/sched_plugin.h @@ -289,6 +289,7 @@ extern sched_obj_list_t sched_get_job_list( void ); #define JOB_FIELD_MIN_DISK "job.min_disk" #define JOB_FIELD_MIN_MEMORY "job.min_mem" #define JOB_FIELD_REQ_NODES "job.req_nodes" +#define JOB_FIELD_ALLOC_NODES "job.alloc_nodes" #define JOB_FIELD_MIN_NODES "job.min_nodes" #define JOB_STATE_LABEL_PENDING "PENDING" diff --git a/src/slurmctld/sched_upcalls.c b/src/slurmctld/sched_upcalls.c index d9b088edefe..8e461f2ddc0 100644 --- a/src/slurmctld/sched_upcalls.c +++ b/src/slurmctld/sched_upcalls.c @@ -116,6 +116,7 @@ static void * sched_get_job_end_time( sched_obj_list_t, int32_t, char * ); static void * sched_get_job_user_id( sched_obj_list_t, int32_t, char * ); static void * sched_get_job_group_name( sched_obj_list_t, int32_t, char * ); static void * sched_get_job_req_nodes( sched_obj_list_t, int32_t, char * ); +static void * sched_get_job_alloc_nodes( sched_obj_list_t, int32_t, char * ); static void * sched_get_job_min_nodes( sched_obj_list_t, int32_t, char * ); static void * sched_get_job_partition( sched_obj_list_t, int32_t, char * ); static void * sched_get_job_min_disk( sched_obj_list_t, int32_t, char * ); @@ -225,6 +226,12 @@ sched_get_accessor( char *field ) { JOB_FIELD_END_TIME, sched_get_job_end_time }, { JOB_FIELD_USER_ID, sched_get_job_user_id }, { JOB_FIELD_GROUP_ID, sched_get_job_group_name }, + /* { JOB_FIELD_ALLOC_NODES, sched_get_job_alloc_nodes }, + * Wiki specifies the nodes to be allocated in the requested node + * field, so that is where we are getting the allocated node + * information from for now. + */ + { JOB_FIELD_ALLOC_NODES, sched_get_job_req_nodes }, { JOB_FIELD_REQ_NODES, sched_get_job_req_nodes }, { JOB_FIELD_MIN_NODES, sched_get_job_min_nodes }, { JOB_FIELD_PARTITION, sched_get_job_partition }, @@ -745,6 +752,36 @@ sched_get_job_req_nodes( sched_obj_list_t job_data, return ""; } + +/* ************************************************************************ */ +/* TAG( sched_get_job_alloc_nodes ) */ +/* ************************************************************************ */ +static void * +sched_get_job_alloc_nodes( sched_obj_list_t job_data, + int32_t idx, + char *type ) +{ + void *cache; + char *nodes; + + if ( type ) *type = 'S'; + nodes = ( (struct job_record *)job_data->data )[ idx ].nodes; + + if ( nodes ) { + if ( ( cache = sched_obj_cache_entry_find( job_data, + idx, + "alloc_nodes" ) ) != NULL ) { + return cache; + } + cache = expand_hostlist( nodes ); + if ( ! cache ) + return nodes; + sched_obj_cache_entry_add( job_data, idx, "alloc_nodes", cache ); + return cache; + } + return ""; +} + /* ************************************************************************ */ /* TAG( sched_get_job_min_nodes ) */ /* ************************************************************************ */ -- GitLab