From a759cf47768df9654ea71860e4e69fbe097cb98e Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Thu, 21 Nov 2002 00:31:55 +0000 Subject: [PATCH] General code clean-up. No logic changes. --- src/api/allocate.c | 23 ++++- src/api/cancel.c | 19 +++- src/api/complete.c | 18 +++- src/api/config_info.c | 20 ++-- src/api/free_msg.c | 17 +++- src/api/init_msg.c | 16 +++- src/api/job_info.c | 19 +++- src/api/job_step_info.c | 13 ++- src/api/node_info.c | 13 ++- src/api/partition_info.c | 14 ++- src/api/reconfigure.c | 17 ++-- src/api/slurm.h | 201 ++++++++++++++++++++++++++++++--------- src/api/submit.c | 9 +- src/api/update_config.c | 20 ++-- 14 files changed, 324 insertions(+), 95 deletions(-) diff --git a/src/api/allocate.c b/src/api/allocate.c index fab4236c695..d449887fbd8 100644 --- a/src/api/allocate.c +++ b/src/api/allocate.c @@ -25,17 +25,22 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> #include <stdio.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" /* * slurm_allocate_resources - allocate resources for a job request + * IN job_desc_msg - description of resource allocation request + * OUT slurm_alloc_msg - response to request + * IN immediate - if set then resource allocation must be satisfied + * immediately or fail + * RET 0 on success or slurm error code * NOTE: free the allocated using slurm_free_resource_allocation_response_msg */ int @@ -118,6 +123,9 @@ slurm_allocate_resources (job_desc_msg_t * job_desc_msg , /* * slurm_job_will_run - determine if a job would execute immediately if * submitted now + * IN job_desc_msg - description of resource allocation request + * OUT slurm_alloc_msg - response to request + * RET 0 on success or slurm error code * NOTE: free the allocated using slurm_free_resource_allocation_response_msg */ int slurm_job_will_run (job_desc_msg_t * job_desc_msg , @@ -193,6 +201,9 @@ int slurm_job_will_run (job_desc_msg_t * job_desc_msg , /* * slurm_allocate_resources_and_run - allocate resources for a job request and * initiate a job step + * IN job_desc_msg - description of resource allocation request + * OUT slurm_alloc_msg - response to request + * RET 0 on success or slurm error code * NOTE: free the response using * slurm_free_resource_allocation_and_run_response_msg */ @@ -270,6 +281,9 @@ slurm_allocate_resources_and_run (job_desc_msg_t * job_desc_msg , /* * slurm_job_step_create - create a job step for a given job id + * IN slurm_step_alloc_req_msg - description of job step request + * OUT slurm_step_alloc_resp_msg - response to request + * RET 0 on success or slurm error code * NOTE: free the response using slurm_free_job_step_create_response_msg */ int @@ -346,6 +360,9 @@ slurm_job_step_create (job_step_create_request_msg_t * slurm_step_alloc_req_msg, /* * slurm_confirm_allocation - confirm an existing resource allocation + * IN job_desc_msg - description of existing job request + * OUT slurm_alloc_msg - response to request + * RET 0 on success or slurm error code * NOTE: free the response using slurm_free_resource_allocation_response_msg */ int diff --git a/src/api/cancel.c b/src/api/cancel.c index b222e18bb0f..1c4da241716 100644 --- a/src/api/cancel.c +++ b/src/api/cancel.c @@ -25,24 +25,33 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> #include <stdio.h> #include <stdlib.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" -/* slurm_cancel_job - cancel an existing job and all of its steps */ +/* + * slurm_cancel_job - cancel an existing job and all of its steps + * IN job_id - the job's id + * RET 0 on success or slurm error code + */ int slurm_cancel_job ( uint32_t job_id ) { return slurm_cancel_job_step ( job_id, NO_VAL); } -/* slurm_cancel_job_step - cancel a specific job step */ +/* + * slurm_cancel_job_step - cancel a specific job step + * IN job_id - the job's id + * IN step_id - the job step's id + * RET 0 on success or slurm error code + */ int slurm_cancel_job_step ( uint32_t job_id, uint32_t step_id ) { diff --git a/src/api/complete.c b/src/api/complete.c index a9aa27a4719..24afbae2a57 100644 --- a/src/api/complete.c +++ b/src/api/complete.c @@ -36,7 +36,13 @@ #include "src/common/hostlist.h" #include "src/common/slurm_protocol_api.h" -/* slurm_complete_job - note the completion of a job and all of its steps */ +/* + * slurm_complete_job - note the completion of a job and all of its steps + * IN job_id - the job's id + * IN job_return_code - the highest exit code of any task of the job + * IN system_return_code - any slurm/system exit code + * RET 0 on success or slurm error code + */ int slurm_complete_job ( uint32_t job_id, uint32_t job_return_code, uint32_t system_return_code ) @@ -45,8 +51,14 @@ slurm_complete_job ( uint32_t job_id, uint32_t job_return_code, system_return_code); } -/* slurm_complete_job_step - note the completion of a specific job step - * (or all steps if step_id==NO_VAL) */ +/* + * slurm_complete_job_step - note the completion of a specific job step + * IN job_id - the job's id + * IN step_id - the job step's id or NO_VAL for all of the job's steps + * IN job_return_code - the highest exit code of any task of the job + * IN system_return_code - any slurm/system exit code + * RET 0 on success or slurm error code + */ int slurm_complete_job_step ( uint32_t job_id, uint32_t step_id, uint32_t job_return_code, diff --git a/src/api/config_info.c b/src/api/config_info.c index af078c17cbd..0f795439bb8 100644 --- a/src/api/config_info.c +++ b/src/api/config_info.c @@ -25,19 +25,23 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> #include <stdio.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> + +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" /* - * slurm_print_ctl_conf - output the contents of slurm control configuration message - * as loaded using slurm_load_ctl_conf + * slurm_print_ctl_conf - output the contents of slurm control configuration + * message as loaded using slurm_load_ctl_conf + * IN out - file to write to + * IN slurm_ctl_conf_ptr - slurm control configuration pointer */ -void slurm_print_ctl_conf ( FILE* out, slurm_ctl_conf_info_msg_t * slurm_ctl_conf_ptr ) +void slurm_print_ctl_conf ( FILE* out, + slurm_ctl_conf_info_msg_t * slurm_ctl_conf_ptr ) { char time_str[16]; @@ -93,6 +97,10 @@ void slurm_print_ctl_conf ( FILE* out, slurm_ctl_conf_info_msg_t * slurm_ctl_con /* * slurm_load_ctl_conf - issue RPC to get slurm control configuration * information if changed since update_time + * IN update_time - time of current configuration data + * IN slurm_ctl_conf_ptr - place to store slurm control configuration + * pointer + * RET 0 on success or slurm error code * NOTE: free the response using slurm_free_ctl_conf */ int diff --git a/src/api/free_msg.c b/src/api/free_msg.c index 180d16cc682..5527c598e92 100644 --- a/src/api/free_msg.c +++ b/src/api/free_msg.c @@ -25,15 +25,15 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> #include <stdio.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> -#include <src/common/xmalloc.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" +#include "src/common/xmalloc.h" static void _free_all_job_info (job_info_msg_t *msg); static void _slurm_free_job_info_members (job_info_t * job); @@ -51,6 +51,7 @@ static void _slurm_free_job_step_info_members (job_step_info_t * msg); /* * slurm_free_resource_allocation_response_msg - free slurm resource * allocation response message + * IN msg - pointer to allocation response message * NOTE: buffer is loaded by slurm_allocate_resources */ void slurm_free_resource_allocation_response_msg ( @@ -73,6 +74,7 @@ void slurm_free_resource_allocation_response_msg ( /* * slurm_free_resource_allocation_and_run_response_msg - free slurm * resource allocation and run job step response message + * IN msg - pointer to allocation and run job step response message * NOTE: buffer is loaded by slurm_allocate_resources_and_run */ void slurm_free_resource_allocation_and_run_response_msg ( @@ -100,6 +102,7 @@ void slurm_free_resource_allocation_and_run_response_msg ( /* * slurm_free_job_step_create_response_msg - free slurm * job step create response message + * IN msg - pointer to job step create response message * NOTE: buffer is loaded by slurm_job_step_create */ void slurm_free_job_step_create_response_msg( @@ -122,6 +125,7 @@ void slurm_free_job_step_create_response_msg( /* * slurm_free_submit_response_response_msg - free slurm * job submit response message + * IN msg - pointer to job submit response message * NOTE: buffer is loaded by slurm_submit_batch_job */ void slurm_free_submit_response_response_msg(submit_response_msg_t * msg) @@ -133,6 +137,7 @@ void slurm_free_submit_response_response_msg(submit_response_msg_t * msg) /* * slurm_free_ctl_conf - free slurm control information response message + * IN msg - pointer to slurm control information response message * NOTE: buffer is loaded by slurm_load_jobs */ void slurm_free_ctl_conf(slurm_ctl_conf_info_msg_t * config_ptr) @@ -171,6 +176,7 @@ void slurm_free_ctl_conf(slurm_ctl_conf_info_msg_t * config_ptr) /* * slurm_free_job_info - free the job information response message + * IN msg - pointer to job information response message * NOTE: buffer is loaded by slurm_load_job. */ void slurm_free_job_info_msg(job_info_msg_t * job_buffer_ptr) @@ -219,6 +225,7 @@ static void _slurm_free_job_info_members(job_info_t * job) /* * slurm_free_job_step_info_response_msg - free the job step * information response message + * IN msg - pointer to job step information response message * NOTE: buffer is loaded by slurm_get_job_steps. */ void slurm_free_job_step_info_response_msg(job_step_info_response_msg_t * @@ -258,6 +265,7 @@ static void _slurm_free_job_step_info_members (job_step_info_t * msg) /* * slurm_free_node_info - free the node information response message + * IN msg - pointer to node information response message * NOTE: buffer is loaded by slurm_load_node. */ void slurm_free_node_info_msg(node_info_msg_t * msg) @@ -299,6 +307,7 @@ static void _slurm_free_node_info_members(node_info_t * node) /* * slurm_free_partition_info_msg - free the partition information * response message + * IN msg - pointer to partition information response message * NOTE: buffer is loaded by slurm_load_partitions */ void slurm_free_partition_info_msg(partition_info_msg_t * msg) diff --git a/src/api/init_msg.c b/src/api/init_msg.c index 0e05e38a835..9fa892dbbbd 100644 --- a/src/api/init_msg.c +++ b/src/api/init_msg.c @@ -25,15 +25,20 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> #include <stdio.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" +/* + * slurm_init_job_desc_msg - initialize job descriptor with + * default values + * OUT job_desc_msg - user defined job descriptor + */ void slurm_init_job_desc_msg(job_desc_msg_t * job_desc_msg) { job_desc_msg->contiguous = @@ -63,6 +68,11 @@ void slurm_init_job_desc_msg(job_desc_msg_t * job_desc_msg) job_desc_msg->work_dir = SLURM_JOB_DESC_DEFAULT_WORKING_DIR; } +/* + * slurm_init_part_desc_msg - initialize partition descriptor with + * default values + * OUT job_desc_msg - user defined partition descriptor + */ void slurm_init_part_desc_msg (update_part_msg_t * update_part_msg) { update_part_msg->name = NULL; diff --git a/src/api/job_info.c b/src/api/job_info.c index 490fc70eef2..37d32adce1f 100644 --- a/src/api/job_info.c +++ b/src/api/job_info.c @@ -25,7 +25,7 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> @@ -33,12 +33,14 @@ #include <stdlib.h> #include <time.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" /* * slurm_print_job_info_msg - output information about all Slurm * jobs based upon message as loaded using slurm_load_jobs + * IN out - file to write to + * IN job_info_msg_ptr - job information message pointer */ void slurm_print_job_info_msg ( FILE* out, job_info_msg_t * job_info_msg_ptr ) @@ -60,6 +62,8 @@ slurm_print_job_info_msg ( FILE* out, job_info_msg_t * job_info_msg_ptr ) /* * slurm_print_job_info - output information about a specific Slurm * job based upon message as loaded using slurm_load_jobs + * IN out - file to write to + * IN job_ptr - an individual job information record pointer */ void slurm_print_job_info ( FILE* out, job_info_t * job_ptr ) @@ -111,7 +115,11 @@ slurm_print_job_info ( FILE* out, job_info_t * job_ptr ) fprintf( out, "\n\n"); } -/* make_time_str - convert time_t to string with "month/date hour:min:sec" */ +/* + * make_time_str - convert time_t to string with "month/date hour:min:sec" + * IN time - a time stamp + * OUT string - pointer user defined buffer + */ void make_time_str (time_t *time, char *string) { @@ -127,6 +135,9 @@ make_time_str (time_t *time, char *string) /* * slurm_load_jobs - issue RPC to get slurm all job configuration * information if changed since update_time + * IN update_time - time of current configuration data + * IN job_info_msg_pptr - place to store a job configuration pointer + * RET 0 or a slurm error code * NOTE: free the response using slurm_free_job_info_msg */ int diff --git a/src/api/job_step_info.c b/src/api/job_step_info.c index c236f26c80e..fe27e053ba0 100644 --- a/src/api/job_step_info.c +++ b/src/api/job_step_info.c @@ -39,6 +39,8 @@ /* * slurm_print_job_step_info_msg - output information about all Slurm * job steps based upon message as loaded using slurm_get_job_steps + * IN out - file to write to + * IN job_step_info_msg_ptr - job step information message pointer */ void slurm_print_job_step_info_msg ( FILE* out, @@ -62,6 +64,8 @@ slurm_print_job_step_info_msg ( FILE* out, /* * slurm_print_job_step_info - output information about a specific Slurm * job step based upon message as loaded using slurm_get_job_steps + * IN out - file to write to + * IN job_ptr - an individual job step information record pointer */ void slurm_print_job_step_info ( FILE* out, job_step_info_t * job_step_ptr ) @@ -79,6 +83,12 @@ slurm_print_job_step_info ( FILE* out, job_step_info_t * job_step_ptr ) * configuration information if changed since update_time. * a job_id value of zero implies all jobs, a step_id value of * zero implies all steps + * IN update_time - time of current configuration data + * IN job_id - get information for specific job id, zero for all jobs + * IN step_id - get information for specific job step id, zero for all + * job steps + * IN job_info_msg_pptr - place to store a job configuration pointer + * RET 0 or a slurm error code * NOTE: free the response using slurm_free_job_step_info_response_msg */ int @@ -138,7 +148,8 @@ slurm_get_job_steps (time_t update_time, uint32_t job_id, uint32_t step_id, return SLURM_PROTOCOL_SUCCESS ; break ; case RESPONSE_SLURM_RC: - slurm_rc_msg = ( return_code_msg_t * ) response_msg.data ; + slurm_rc_msg = + ( return_code_msg_t * ) response_msg.data ; rc = slurm_rc_msg->return_code; slurm_free_return_code_msg ( slurm_rc_msg ); if (rc) { diff --git a/src/api/node_info.c b/src/api/node_info.c index 04520aab9fd..02784216343 100644 --- a/src/api/node_info.c +++ b/src/api/node_info.c @@ -25,7 +25,7 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> @@ -37,12 +37,14 @@ #include <arpa/inet.h> #include <unistd.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" /* * slurm_print_node_info_msg - output information about all Slurm nodes * based upon message as loaded using slurm_load_node + * IN out - file to write to + * IN node_info_msg_ptr - node information message pointer */ void slurm_print_node_info_msg ( FILE * out, node_info_msg_t * node_info_msg_ptr ) @@ -65,6 +67,8 @@ slurm_print_node_info_msg ( FILE * out, node_info_msg_t * node_info_msg_ptr ) /* * slurm_print_node_table - output information about a specific Slurm nodes * based upon message as loaded using slurm_load_node + * IN out - file to write to + * IN node_ptr - an individual node information record pointer */ void slurm_print_node_table ( FILE * out, node_info_t * node_ptr ) @@ -82,6 +86,9 @@ slurm_print_node_table ( FILE * out, node_info_t * node_ptr ) /* * slurm_load_node - issue RPC to get slurm all node configuration information * if changed since update_time + * IN update_time - time of current configuration data + * IN node_info_msg_pptr - place to store a node configuration pointer + * RET 0 or a slurm error code * NOTE: free the response using slurm_free_node_info_msg */ int diff --git a/src/api/partition_info.c b/src/api/partition_info.c index 1287c52521a..0101cddd12e 100644 --- a/src/api/partition_info.c +++ b/src/api/partition_info.c @@ -25,20 +25,22 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> #include <stdio.h> #include <stdlib.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" /* * slurm_print_partition_info_msg - output information about all Slurm * partitions based upon message as loaded using slurm_load_partitions + * IN out - file to write to + * IN part_info_ptr - partitions information message pointer */ void slurm_print_partition_info_msg ( FILE* out, partition_info_msg_t * part_info_ptr ) @@ -60,6 +62,8 @@ void slurm_print_partition_info_msg ( FILE* out, /* * slurm_print_partition_info - output information about a specific Slurm * partition based upon message as loaded using slurm_load_partitions + * IN out - file to write to + * IN part_ptr - an individual partition information record pointer */ void slurm_print_partition_info ( FILE* out, partition_info_t * part_ptr ) { @@ -114,6 +118,10 @@ void slurm_print_partition_info ( FILE* out, partition_info_t * part_ptr ) /* * slurm_load_partitions - issue RPC to get slurm all partition configuration * information if changed since update_time + * IN update_time - time of current configuration data + * IN partition_info_msg_pptr - place to store a partition configuration + * pointer + * RET 0 or a slurm error code * NOTE: free the response using slurm_free_partition_info_msg */ int diff --git a/src/api/reconfigure.c b/src/api/reconfigure.c index 309fe08d749..0f33b712d36 100644 --- a/src/api/reconfigure.c +++ b/src/api/reconfigure.c @@ -25,8 +25,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. \*****************************************************************************/ -#ifdef have_config_h -# include <config.h> +#ifdef HAVE_CONFIG_H +# include "config.h" #endif #include <errno.h> @@ -34,15 +34,16 @@ #include <stdlib.h> #include <unistd.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" static int _send_message_controller ( enum controller_id dest, slurm_msg_t *request_msg ); /* * slurm_reconfigure - issue RPC to have Slurm controller (slurmctld) - * reload its configuration file + * reload its configuration file + * RET 0 or a slurm error code */ int slurm_reconfigure ( void ) @@ -111,7 +112,8 @@ slurm_reconfigure ( void ) * slurm_shutdown - issue RPC to have Slurm controller (slurmctld) * cease operations, both the primary and backup controller * are shutdown. - * core(I) - controller generates a core file if set + * IN core - controller generates a core file if set + * RET 0 or a slurm error code */ int slurm_shutdown (uint16_t core) @@ -172,7 +174,8 @@ _send_message_controller ( enum controller_id dest, slurm_msg_t *request_msg ) switch ( response_msg . msg_type ) { case RESPONSE_SLURM_RC: - slurm_rc_msg = ( return_code_msg_t * ) response_msg . data ; + slurm_rc_msg = + ( return_code_msg_t * ) response_msg . data ; rc = slurm_rc_msg->return_code; slurm_free_return_code_msg ( slurm_rc_msg ); if (rc) { diff --git a/src/api/slurm.h b/src/api/slurm.h index ba08fde9e07..992288c1d57 100644 --- a/src/api/slurm.h +++ b/src/api/slurm.h @@ -29,15 +29,15 @@ #define _SLURM_H /* FIXME: Need need better way to get configuration info */ -#include <config.h> /* used for possible HAVE_LIBELAN3 */ +#include "config.h" /* used for possible HAVE_LIBELAN3 */ #include <stdint.h> /* for uint16_t, uint32_t definitions */ #include <stdio.h> /* for FILE definitions */ #include <time.h> /* for time_t definitions */ /* FIXME: Need to park these headers in generally available location */ -#include <src/common/slurm_errno.h> -#include <src/common/hostlist.h> +#include "src/common/slurm_errno.h" +#include "src/common/hostlist.h" /* Define slurm_addr below to avoid including extraneous slurm headers */ #ifdef HAVE_SYS_SOCKET_H @@ -156,11 +156,12 @@ typedef struct job_descriptor { /* For submit, allocate, and update requests */ char *name; /* name of the job, default "" */ uint32_t min_procs; /* minimum processors per node, default=0 */ uint32_t min_memory; /* minimum real memory per node, default=0 */ - uint32_t min_tmp_disk; /* minimum temporary disk per node, default=0 */ + uint32_t min_tmp_disk; /* minimum temporary disk per node, + * default=0 */ char *partition; /* name of requested partition, * default in SLURM config */ - uint32_t priority; /* relative priority of the job, explicitly only - * for user root */ + uint32_t priority; /* relative priority of the job, explicitly + * set only for user root */ char *req_nodes; /* comma separated list of required nodes * default NONE */ uint16_t shared; /* 1 if job can share nodes with other jobs, @@ -169,7 +170,8 @@ typedef struct job_descriptor { /* For submit, allocate, and update requests */ * partition limit */ uint32_t num_procs; /* total count of processors required, * default=0 */ - uint32_t num_nodes; /* number of nodes required by job, default=0 */ + uint32_t num_nodes; /* number of nodes required by job, + * default=0 */ char *script; /* the actual job script, default NONE */ char *err; /* pathname of stderr */ char *in; /* pathname of stdin */ @@ -250,7 +252,8 @@ typedef struct job_step_info_response_msg { typedef struct node_info { char *name; /* node name */ uint16_t node_state; /* see enum node_states */ - uint32_t cpus; /* configured count of cpus running on the node */ + uint32_t cpus; /* configured count of cpus running on + * the node */ uint32_t real_memory; /* configured MB of real memory on the node */ uint32_t tmp_disk; /* configured MB of total disk in TMP_FS */ uint32_t weight; /* arbitrary priority of node for scheduling */ @@ -330,18 +333,19 @@ typedef struct slurm_ctl_conf { uint16_t fast_schedule; /* 1 to *not* check configurations by node * (only check configuration file, faster) */ uint16_t hash_base; /* base used for hashing node table */ - uint16_t heartbeat_interval; /* interval between heartbeats, seconds */ - uint16_t inactive_limit; /* seconds of inactivity before a - * non-active resource allocation is released */ + uint16_t heartbeat_interval; /* interval between heartbeats, seconds */ + uint16_t inactive_limit;/* seconds of inactivity before a + * inactive resource allocation is released */ uint16_t kill_wait; /* seconds between SIGXCPU to SIGKILL * on job termination */ char *prioritize; /* pathname of program to set initial job * priority */ char *prolog; /* pathname of job prolog */ - uint16_t ret2service; /* 1 return DOWN node to service at registration */ + uint16_t ret2service; /* 1 return DOWN node to service at + * registration */ char *slurmctld_logfile;/* where slurmctld error log gets written */ uint32_t slurmctld_port;/* default communications port to slurmctld */ - uint16_t slurmctld_timeout; /* seconds that backup controller waits + uint16_t slurmctld_timeout;/* seconds that backup controller waits * on non-responding primarly controller */ char *slurmd_logfile; /* where slurmd error log gets written */ uint32_t slurmd_port; /* default communications port to slurmd */ @@ -349,10 +353,11 @@ typedef struct slurm_ctl_conf { uint16_t slurmd_timeout;/* how long slurmctld waits for slurmd before * considering node DOWN */ char *slurm_conf; /* pathname of slurm config file */ - char *state_save_location;/* pathname of slurmctld state save directory */ + char *state_save_location;/* pathname of slurmctld state save + * directory */ char *tmp_fs; /* pathname of temporary file system */ char *job_credential_private_key; /* path to private key */ - char *job_credential_public_certificate; /* path to public certificate */ + char *job_credential_public_certificate;/* path to public certificate*/ } slurm_ctl_conf_t; typedef struct submit_response_msg { @@ -370,12 +375,21 @@ typedef struct partition_info update_part_msg_t; * RESOURCE ALLOCATION FUNCTIONS \*****************************************************************************/ -/* slurm_init_job_desc_msg - set default job descriptor values */ +/* + * slurm_init_job_desc_msg - initialize job descriptor with + * default values + * OUT job_desc_msg - user defined job descriptor + */ extern void slurm_init_job_desc_msg (job_desc_msg_t * job_desc_msg); /* * slurm_allocate_resources - allocate resources for a job request - * NOTE: free the response using slurm_free_resource_allocation_response_msg + * IN job_desc_msg - description of resource allocation request + * OUT slurm_alloc_msg - response to request + * IN immediate - if set then resource allocation must be satisfied + * immediately or fail + * RET 0 on success or slurm error code + * NOTE: free the allocated using slurm_free_resource_allocation_response_msg */ extern int slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t ** job_alloc_resp_msg, @@ -384,8 +398,8 @@ extern int slurm_allocate_resources (job_desc_msg_t * job_desc_msg , /* * slurm_free_resource_allocation_response_msg - free slurm resource * allocation response message - * NOTE: buffer is loaded by either slurm_allocate_resources or - * slurm_confirm_allocation + * IN msg - pointer to allocation response message + * NOTE: buffer is loaded by slurm_allocate_resources */ extern void slurm_free_resource_allocation_response_msg ( resource_allocation_response_msg_t * msg); @@ -393,6 +407,9 @@ extern void slurm_free_resource_allocation_response_msg ( /* * slurm_allocate_resources_and_run - allocate resources for a job request and * initiate a job step + * IN job_desc_msg - description of resource allocation request + * OUT slurm_alloc_msg - response to request + * RET 0 on success or slurm error code * NOTE: free the response using * slurm_free_resource_allocation_and_run_response_msg */ @@ -402,6 +419,7 @@ extern int slurm_allocate_resources_and_run (job_desc_msg_t * job_desc_msg, /* * slurm_free_resource_allocation_and_run_response_msg - free slurm * resource allocation and run job step response message + * IN msg - pointer to allocation and run job step response message * NOTE: buffer is loaded by slurm_allocate_resources_and_run */ extern void slurm_free_resource_allocation_and_run_response_msg ( @@ -409,6 +427,9 @@ extern void slurm_free_resource_allocation_and_run_response_msg ( /* * slurm_confirm_allocation - confirm an existing resource allocation + * IN job_desc_msg - description of existing job request + * OUT slurm_alloc_msg - response to request + * RET 0 on success or slurm error code * NOTE: free the response using slurm_free_resource_allocation_response_msg */ extern int slurm_confirm_allocation (old_job_alloc_msg_t * job_desc_msg , @@ -416,6 +437,9 @@ extern int slurm_confirm_allocation (old_job_alloc_msg_t * job_desc_msg , /* * slurm_job_step_create - create a job step for a given job id + * IN slurm_step_alloc_req_msg - description of job step request + * OUT slurm_step_alloc_resp_msg - response to request + * RET 0 on success or slurm error code * NOTE: free the response using slurm_free_job_step_create_response_msg */ extern int slurm_job_step_create ( @@ -425,16 +449,18 @@ extern int slurm_job_step_create ( /* * slurm_free_job_step_create_response_msg - free slurm * job step create response message + * IN msg - pointer to job step create response message * NOTE: buffer is loaded by slurm_job_step_create */ extern void slurm_free_job_step_create_response_msg ( job_step_create_response_msg_t *msg); /* - * slurm_submit_batch_job - issue RPC to submit a job for later - * execution - * NOTE: free the response using - * slurm_free_submit_response_response_msg + * slurm_submit_batch_job - issue RPC to submit a job for later execution + * NOTE: free the response using slurm_free_submit_response_response_msg + * IN job_desc_msg - description of batch job request + * OUT slurm_alloc_msg - response to request + * RET 0 on success or slurm error code */ extern int slurm_submit_batch_job (job_desc_msg_t * job_desc_msg, submit_response_msg_t ** slurm_alloc_msg ); @@ -442,6 +468,7 @@ extern int slurm_submit_batch_job (job_desc_msg_t * job_desc_msg, /* * slurm_free_submit_response_response_msg - free slurm * job submit response message + * IN msg - pointer to job submit response message * NOTE: buffer is loaded by slurm_submit_batch_job */ extern void slurm_free_submit_response_response_msg ( @@ -450,7 +477,10 @@ extern void slurm_free_submit_response_response_msg ( /* * slurm_job_will_run - determine if a job would execute immediately if * submitted now - * NOTE: free the response using slurm_free_resource_allocation_response_msg + * IN job_desc_msg - description of resource allocation request + * OUT slurm_alloc_msg - response to request + * RET 0 on success or slurm error code + * NOTE: free the allocated using slurm_free_resource_allocation_response_msg */ extern int slurm_job_will_run (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t ** job_alloc_resp_msg ); @@ -460,10 +490,19 @@ extern int slurm_job_will_run (job_desc_msg_t * job_desc_msg , * JOB/STEP CANCELATION FUNCTIONS \*****************************************************************************/ -/* slurm_cancel_job - cancel an existing job and all of its steps */ +/* + * slurm_cancel_job - cancel an existing job and all of its steps + * IN job_id - the job's id + * RET 0 on success or slurm error code + */ extern int slurm_cancel_job (uint32_t job_id); -/* slurm_cancel_job_step - cancel a specific job step */ +/* + * slurm_cancel_job_step - cancel a specific job step + * IN job_id - the job's id + * IN step_id - the job step's id + * RET 0 on success or slurm error code + */ extern int slurm_cancel_job_step (uint32_t job_id, uint32_t step_id); @@ -471,11 +510,24 @@ extern int slurm_cancel_job_step (uint32_t job_id, uint32_t step_id); * JOB/STEP COMPLETION FUNCTIONS \*****************************************************************************/ -/* slurm_complete_job - note the completion of a job and all of its steps */ +/* + * slurm_complete_job - note the completion of a job and all of its steps + * IN job_id - the job's id + * IN job_return_code - the highest exit code of any task of the job + * IN system_return_code - any slurm/system exit code + * RET 0 on success or slurm error code + */ extern int slurm_complete_job (uint32_t job_id, uint32_t job_return_code, uint32_t system_return_code ); -/* slurm_complete_job_step - note the completion of a specific job step */ +/* + * slurm_complete_job_step - note the completion of a specific job step + * IN job_id - the job's id + * IN step_id - the job step's id or NO_VAL for all of the job's steps + * IN job_return_code - the highest exit code of any task of the job + * IN system_return_code - any slurm/system exit code + * RET 0 on success or slurm error code + */ extern int slurm_complete_job_step (uint32_t job_id, uint32_t step_id, uint32_t job_return_code, uint32_t system_return_code ); @@ -485,12 +537,20 @@ extern int slurm_complete_job_step (uint32_t job_id, uint32_t step_id, * SLURM CONTROL CONFIGURATION READ/PRINT/UPDATE FUNCTIONS \*****************************************************************************/ -/* make_time_str - convert time_t to string with "month/date hour:min:sec" */ +/* + * make_time_str - convert time_t to string with "month/date hour:min:sec" + * IN time - a time stamp + * OUT string - pointer user defined buffer + */ extern void make_time_str (time_t *time, char *string); /* * slurm_load_ctl_conf - issue RPC to get slurm control configuration * information if changed since update_time + * IN update_time - time of current configuration data + * IN slurm_ctl_conf_ptr - place to store slurm control configuration + * pointer + * RET 0 on success or slurm error code * NOTE: free the response using slurm_free_ctl_conf */ extern int slurm_load_ctl_conf (time_t update_time, @@ -498,13 +558,16 @@ extern int slurm_load_ctl_conf (time_t update_time, /* * slurm_free_ctl_conf - free slurm control information response message - * NOTE: buffer is loaded by slurm_load_ctl_conf + * IN msg - pointer to slurm control information response message + * NOTE: buffer is loaded by slurm_load_jobs */ extern void slurm_free_ctl_conf (slurm_ctl_conf_t* slurm_ctl_conf_ptr); /* - * slurm_print_ctl_conf - output the contents of slurm control configuration + * slurm_print_ctl_conf - output the contents of slurm control configuration * message as loaded using slurm_load_ctl_conf + * IN out - file to write to + * IN slurm_ctl_conf_ptr - slurm control configuration pointer */ extern void slurm_print_ctl_conf ( FILE * out, slurm_ctl_conf_t* slurm_ctl_conf ) ; @@ -517,13 +580,17 @@ extern void slurm_print_ctl_conf ( FILE * out, /* * slurm_load_jobs - issue RPC to get slurm all job configuration * information if changed since update_time + * IN update_time - time of current configuration data + * IN job_info_msg_pptr - place to store a job configuration pointer + * RET 0 or a slurm error code * NOTE: free the response using slurm_free_job_info_msg */ extern int slurm_load_jobs (time_t update_time, job_info_msg_t **job_info_msg_pptr); /* - * slurm_free_job_info_msg - free the job information response message + * slurm_free_job_info - free the job information response message + * IN msg - pointer to job information response message * NOTE: buffer is loaded by slurm_load_job. */ extern void slurm_free_job_info_msg (job_info_msg_t * job_buffer_ptr); @@ -531,6 +598,8 @@ extern void slurm_free_job_info_msg (job_info_msg_t * job_buffer_ptr); /* * slurm_print_job_info_msg - output information about all Slurm * jobs based upon message as loaded using slurm_load_jobs + * IN out - file to write to + * IN job_info_msg_ptr - job information message pointer */ extern void slurm_print_job_info_msg ( FILE * out, job_info_msg_t * job_info_msg_ptr ) ; @@ -538,12 +607,16 @@ extern void slurm_print_job_info_msg ( FILE * out, /* * slurm_print_job_info - output information about a specific Slurm * job based upon message as loaded using slurm_load_jobs + * IN out - file to write to + * IN job_ptr - an individual job information record pointer */ extern void slurm_print_job_info ( FILE*, job_info_t * job_ptr ); /* * slurm_update_job - issue RPC to a job's configuration per request, * only usable by user root or (for some parameters) the job's owner + * IN job_msg - description of job updates + * RET 0 on success or slurm error code */ extern int slurm_update_job ( job_desc_msg_t * job_msg ) ; @@ -557,6 +630,12 @@ extern int slurm_update_job ( job_desc_msg_t * job_msg ) ; * configuration information if changed since update_time. * a job_id value of zero implies all jobs, a step_id value of * zero implies all steps + * IN update_time - time of current configuration data + * IN job_id - get information for specific job id, zero for all jobs + * IN step_id - get information for specific job step id, zero for all + * job steps + * IN job_info_msg_pptr - place to store a job configuration pointer + * RET 0 or a slurm error code * NOTE: free the response using slurm_free_job_step_info_response_msg */ extern int slurm_get_job_steps (time_t update_time, uint32_t job_id, @@ -566,6 +645,7 @@ extern int slurm_get_job_steps (time_t update_time, uint32_t job_id, /* * slurm_free_job_step_info_response_msg - free the job step * information response message + * IN msg - pointer to job step information response message * NOTE: buffer is loaded by slurm_get_job_steps. */ extern void slurm_free_job_step_info_response_msg ( @@ -574,6 +654,8 @@ extern void slurm_free_job_step_info_response_msg ( /* * slurm_print_job_step_info_msg - output information about all Slurm * job steps based upon message as loaded using slurm_get_job_steps + * IN out - file to write to + * IN job_step_info_msg_ptr - job step information message pointer */ extern void slurm_print_job_step_info_msg ( FILE * out, job_step_info_response_msg_t * job_step_info_msg_ptr ); @@ -581,8 +663,11 @@ extern void slurm_print_job_step_info_msg ( FILE * out, /* * slurm_print_job_step_info - output information about a specific Slurm * job step based upon message as loaded using slurm_get_job_steps + * IN out - file to write to + * IN job_ptr - an individual job step information record pointer */ -extern void slurm_print_job_step_info ( FILE*, job_step_info_t * step_ptr ); +extern void slurm_print_job_step_info ( FILE * out, + job_step_info_t * step_ptr ); /*****************************************************************************\ @@ -590,15 +675,19 @@ extern void slurm_print_job_step_info ( FILE*, job_step_info_t * step_ptr ); \*****************************************************************************/ /* - * slurm_load_node - issue RPC to get slurm all node configuration - * information if changed since update_time + * slurm_load_node - issue RPC to get slurm all node configuration information + * if changed since update_time + * IN update_time - time of current configuration data + * IN node_info_msg_pptr - place to store a node configuration pointer + * RET 0 or a slurm error code * NOTE: free the response using slurm_free_node_info_msg */ extern int slurm_load_node (time_t update_time, node_info_msg_t **node_info_msg_pptr); /* - * slurm_free_node_info_msg - free the node message information buffer + * slurm_free_node_info - free the node information response message + * IN msg - pointer to node information response message * NOTE: buffer is loaded by slurm_load_node. */ extern void slurm_free_node_info_msg (node_info_msg_t * node_buffer_ptr); @@ -606,19 +695,25 @@ extern void slurm_free_node_info_msg (node_info_msg_t * node_buffer_ptr); /* * slurm_print_node_info_msg - output information about all Slurm nodes * based upon message as loaded using slurm_load_node + * IN out - file to write to + * IN node_info_msg_ptr - node information message pointer */ extern void slurm_print_node_info_msg ( FILE * out, node_info_msg_t * node_info_msg_ptr ) ; /* - * slurm_print_node_table - output information about a specific Slurm node + * slurm_print_node_table - output information about a specific Slurm nodes * based upon message as loaded using slurm_load_node + * IN out - file to write to + * IN node_ptr - an individual node information record pointer */ extern void slurm_print_node_table ( FILE * out, node_info_t * node_ptr ); /* - * slurm_update_node - issue RPC to a nodes's configuration per request, + * slurm_update_node - issue RPC to a node's configuration per request, * only usable by user root + * IN node_msg - description of node updates + * RET 0 on success or slurm error code */ extern int slurm_update_node ( update_node_msg_t * node_msg ) ; @@ -627,19 +722,29 @@ extern int slurm_update_node ( update_node_msg_t * node_msg ) ; * SLURM PARTITION CONFIGURATION READ/PRINT/UPDATE FUNCTIONS \*****************************************************************************/ -/* slurm_init_part_desc_msg - set default partition configuration parameters */ +/* + * slurm_init_part_desc_msg - initialize partition descriptor with + * default values + * OUT job_desc_msg - user defined partition descriptor + */ void slurm_init_part_desc_msg (update_part_msg_t * update_part_msg); /* - * slurm_load_partitions - issue RPC to get slurm all partition - * configuration information if changed since update_time + * slurm_load_partitions - issue RPC to get slurm all partition configuration + * information if changed since update_time + * IN update_time - time of current configuration data + * IN partition_info_msg_pptr - place to store a partition configuration + * pointer + * RET 0 or a slurm error code * NOTE: free the response using slurm_free_partition_info_msg */ extern int slurm_load_partitions (time_t update_time, partition_info_msg_t **part_buffer_ptr); /* - * slurm_free_partition_info_msg - free the partition information buffer + * slurm_free_partition_info_msg - free the partition information + * response message + * IN msg - pointer to partition information response message * NOTE: buffer is loaded by slurm_load_partitions */ extern void slurm_free_partition_info_msg ( partition_info_msg_t * part_info_ptr); @@ -647,6 +752,8 @@ extern void slurm_free_partition_info_msg ( partition_info_msg_t * part_info_ptr /* * slurm_print_partition_info_msg - output information about all Slurm * partitions based upon message as loaded using slurm_load_partitions + * IN out - file to write to + * IN part_info_ptr - partitions information message pointer */ extern void slurm_print_partition_info_msg ( FILE * out, partition_info_msg_t * part_info_ptr ) ; @@ -654,6 +761,8 @@ extern void slurm_print_partition_info_msg ( FILE * out, /* * slurm_print_partition_info - output information about a specific Slurm * partition based upon message as loaded using slurm_load_partitions + * IN out - file to write to + * IN part_ptr - an individual partition information record pointer */ extern void slurm_print_partition_info ( FILE *out , partition_info_t * part_ptr ) ; @@ -661,6 +770,8 @@ extern void slurm_print_partition_info ( FILE *out , /* * slurm_update_partition - issue RPC to a partition's configuration per * request, only usable by user root + * IN part_msg - description of partition updates + * RET 0 on success or slurm error code */ extern int slurm_update_partition ( update_part_msg_t * part_msg ) ; @@ -671,7 +782,8 @@ extern int slurm_update_partition ( update_part_msg_t * part_msg ) ; /* * slurm_reconfigure - issue RPC to have Slurm controller (slurmctld) - * reload its configuration file + * reload its configuration file + * RET 0 or a slurm error code */ extern int slurm_reconfigure ( void ); @@ -679,7 +791,8 @@ extern int slurm_reconfigure ( void ); * slurm_shutdown - issue RPC to have Slurm controller (slurmctld) * cease operations, both the primary and backup controller * are shutdown. - * core(I) - controller generates a core file if set + * IN core - controller generates a core file if set + * RET 0 or a slurm error code */ extern int slurm_shutdown (uint16_t core); diff --git a/src/api/submit.c b/src/api/submit.c index df3d8e402c8..9c8b98ccb50 100644 --- a/src/api/submit.c +++ b/src/api/submit.c @@ -25,19 +25,22 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> #include <stdio.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" /* * slurm_submit_batch_job - issue RPC to submit a job for later execution * NOTE: free the response using slurm_free_submit_response_response_msg + * IN job_desc_msg - description of batch job request + * OUT slurm_alloc_msg - response to request + * RET 0 on success or slurm error code */ int slurm_submit_batch_job (job_desc_msg_t * job_desc_msg, diff --git a/src/api/update_config.c b/src/api/update_config.c index 592ec6c9711..3ef50c9bb3d 100644 --- a/src/api/update_config.c +++ b/src/api/update_config.c @@ -25,20 +25,23 @@ \*****************************************************************************/ #ifdef HAVE_CONFIG_H -# include <config.h> +# include "config.h" #endif #include <errno.h> #include <stdio.h> #include <stdlib.h> -#include <src/api/slurm.h> -#include <src/common/slurm_protocol_api.h> + +#include "src/api/slurm.h" +#include "src/common/slurm_protocol_api.h" static int _slurm_update (void * data, slurm_msg_type_t msg_type); /* * slurm_update_job - issue RPC to a job's configuration per request, * only usable by user root or (for some parameters) the job's owner + * IN job_msg - description of job updates + * RET 0 on success or slurm error code */ int slurm_update_job ( job_desc_msg_t * job_msg ) @@ -47,8 +50,10 @@ slurm_update_job ( job_desc_msg_t * job_msg ) } /* - * slurm_update_node - issue RPC to a nodes's configuration per request, + * slurm_update_node - issue RPC to a node's configuration per request, * only usable by user root + * IN node_msg - description of node updates + * RET 0 on success or slurm error code */ int slurm_update_node ( update_node_msg_t * node_msg ) @@ -59,6 +64,8 @@ slurm_update_node ( update_node_msg_t * node_msg ) /* * slurm_update_partition - issue RPC to a partition's configuration per * request, only usable by user root + * IN part_msg - description of partition updates + * RET 0 on success or slurm error code */ int slurm_update_partition ( update_part_msg_t * part_msg ) @@ -68,7 +75,7 @@ slurm_update_partition ( update_part_msg_t * part_msg ) /* _slurm_update - issue RPC for all update requests */ -int +static int _slurm_update (void * data, slurm_msg_type_t msg_type) { int msg_size; @@ -113,7 +120,8 @@ _slurm_update (void * data, slurm_msg_type_t msg_type) switch ( response_msg . msg_type ) { case RESPONSE_SLURM_RC: - slurm_rc_msg = ( return_code_msg_t *) response_msg.data ; + slurm_rc_msg = + ( return_code_msg_t *) response_msg.data ; rc = slurm_rc_msg->return_code; slurm_free_return_code_msg ( slurm_rc_msg ); if (rc) { -- GitLab