diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c index 620bc3cc9b96d49d77c0495ae306575c64777f76..d82daf2901e7b4fe4ad96c0459b3e118c859e65e 100644 --- a/src/common/slurm_protocol_defs.c +++ b/src/common/slurm_protocol_defs.c @@ -194,6 +194,15 @@ void slurm_free_node_table ( node_table_t * node ) } } +void slurm_free_job_allocation_response_msg ( job_allocation_response_msg_t * job_alloc_resp_msg ) +{ + if ( job_alloc_resp_msg ) + { + if ( job_alloc_resp_msg -> node_list ) + xfree ( job_alloc_resp_msg -> node_list); + xfree ( job_alloc_resp_msg ) ; + } +} void slurm_init_job_desc_msg ( job_desc_msg_t * job_desc_msg ) diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h index f9d02ae0a5d4e66a9435b55063d4d1dca1e055de..bc0237126fe4769db6b6fcd73f53493032e8a94f 100644 --- a/src/common/slurm_protocol_defs.h +++ b/src/common/slurm_protocol_defs.h @@ -43,6 +43,10 @@ typedef enum { test1, test2 #define RESPONSE_JOB_RESOURCE 4052 #define REQUEST_JOB_ATTACH 4061 #define RESPONSE_JOB_ATTACH 4062 +#define REQUEST_IMMEDIATE_RESOURCE_ALLOCATION 4071 +#define RESPONSE_IMMEDIATE_RESOURCE_ALLOCATION 4072 +#define REQUEST_WILL_JOB_RUN 4081 +#define RESPONSE_WILL_JOB_RUN 4082 #define MESSAGE_REVOKE_JOB_CREDENTIAL 4901 #define REQUEST_BUILD_INFO 3011 @@ -58,7 +62,7 @@ typedef enum { test1, test2 #define REQUEST_ACCTING_INFO 3061 #define RESPONSE_ACCOUNTING_INFO 3062 #define REQUEST_GET_JOB_STEP_INFO 3071 -#define RESPONSE_GET_JOB_STEP_INFO 4072 +#define RESPONSE_GET_JOB_STEP_INFO 3072 #define REQUEST_CREATE_JOB_STEP 5001 #define RESPONSE_CREATE_JOB_STEP 5002 @@ -121,6 +125,12 @@ typedef struct slurm_node_registration_status_msg uint32_t temporary_disk_space ; } node_registration_status_msg_t ; +typedef struct slurm_job_allocation_response_msg +{ + uint32_t job_id; + char* node_list; +} job_allocation_response_msg_t ; + typedef struct job_desc_msg { /* Job descriptor for submit, allocate, and update requests */ uint16_t contiguous; /* 1 if job requires contiguous nodes, 0 otherwise, * default=0 */ @@ -283,7 +293,11 @@ void inline slurm_free_node_table_msg ( node_table_t * node ) ; /* stuct init functions */ #define SLURM_JOB_DESC_NONCONTIGUOUS 0 #define SLURM_JOB_DESC_CONTIGUOUS 1 -#define SLURM_JOB_DESC_DEFAULT_CONTIGUOUS SLURM_JOB_DESC_NONCONTIGUOUS +#define SLURM_JOB_DESC_SHARED 1 +#define SLURM_JOB_DESC_NOT_SHARED 0 +#define SLURM_JOB_DESC_FORCED_SHARED 2 + +#define SLURM_JOB_DESC_DEFAULT_CONTIGUOUS SLURM_JOB_DESC_NONCONTIGUOUS #define SLURM_JOB_DESC_DEFAULT_FEATURES NULL #define SLURM_JOB_DESC_DEFAULT_GROUPS NULL #define SLURM_JOB_DESC_DEFAULT_JOB_ID NO_VAL @@ -296,9 +310,6 @@ void inline slurm_free_node_table_msg ( node_table_t * node ) ; #define SLURM_JOB_DESC_DEFAULT_PRIORITY NO_VAL #define SLURM_JOB_DESC_DEFAULT_REQ_NODES NULL #define SLURM_JOB_DESC_DEFAULT_JOB_SCRIPT NULL -#define SLURM_JOB_DESC_SHARED 1 -#define SLURM_JOB_DESC_NOT_SHARED 0 -#define SLURM_JOB_DESC_FORCED_SHARED 2 #define SLURM_JOB_DESC_DEFAULT_SHARED SLURM_JOB_DESC_NOT_SHARED #define SLURM_JOB_DESC_DEFAULT_TIME_LIMIT NO_VAL #define SLURM_JOB_DESC_DEFAULT_NUM_PROCS NO_VAL diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index c41a8e1d124b533fff682926980af3e3d5b907fc..e3c227d987f02cda7b27029fb9062bf4af504dd8 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -72,13 +72,19 @@ int pack_msg ( slurm_msg_t const * msg , char ** buffer , uint32_t * buf_len ) break ; case REQUEST_RESOURCE_ALLOCATION : case REQUEST_SUBMIT_BATCH_JOB : + case REQUEST_IMMEDIATE_RESOURCE_ALLOCATION : + case REQUEST_WILL_JOB_RUN : pack_job_desc ( (job_desc_msg_t * ) msg -> data , ( void ** ) buffer , buf_len ) ; break ; case REQUEST_RECONFIGURE : /* Message contains no body/information */ break ; + case RESPONSE_RESOURCE_ALLOCATION : + case RESPONSE_IMMEDIATE_RESOURCE_ALLOCATION : + case RESPONSE_WILL_JOB_RUN : + pack_job_allocation_response_msg ( ( job_allocation_response_msg_t * ) msg -> data , buffer , buf_len ) ; + break ; - case REQUEST_CANCEL_JOB : break ; case REQUEST_CANCEL_JOB_STEP : @@ -169,11 +175,18 @@ int unpack_msg ( slurm_msg_t * msg , char ** buffer , uint32_t * buf_len ) break ; case REQUEST_RESOURCE_ALLOCATION : case REQUEST_SUBMIT_BATCH_JOB : + case REQUEST_IMMEDIATE_RESOURCE_ALLOCATION : + case REQUEST_WILL_JOB_RUN : unpack_job_desc ( ( job_desc_msg_t **) & ( msg-> data ), ( void ** ) buffer , buf_len ) ; break ; case REQUEST_RECONFIGURE : /* Message contains no body/information */ break ; + case RESPONSE_RESOURCE_ALLOCATION : + case RESPONSE_IMMEDIATE_RESOURCE_ALLOCATION : + case RESPONSE_WILL_JOB_RUN : + unpack_job_allocation_response_msg ( ( job_allocation_response_msg_t ** ) & ( msg -> data ) , buffer , buf_len ) ; + break ; case REQUEST_CANCEL_JOB : break ; @@ -229,6 +242,31 @@ int unpack_msg ( slurm_msg_t * msg , char ** buffer , uint32_t * buf_len ) return 0 ; } +void pack_job_allocation_response_msg ( job_allocation_response_msg_t * msg, char ** buffer , uint32_t * length ) +{ + pack32 ( msg -> job_id , ( void ** ) buffer , length ) ; + packstr ( msg -> node_list , ( void ** ) buffer , length ) ; +} + +int unpack_job_allocation_response_msg ( job_allocation_response_msg_t ** msg , char ** buffer , uint32_t * length ) +{ + uint16_t uint16_tmp; + job_allocation_response_msg_t * tmp_ptr ; + /* alloc memory for structure */ + tmp_ptr = xmalloc ( sizeof ( job_allocation_response_msg_t ) ) ; + if (tmp_ptr == NULL) + { + return ENOMEM; + } + + /* load the data values */ + /* unpack timestamp of snapshot */ + unpack32 ( & tmp_ptr -> job_id , ( void ** ) buffer , length ) ; + unpackstr_xmalloc ( & tmp_ptr -> node_list , &uint16_tmp, ( void ** ) buffer , length ) ; + *msg = tmp_ptr ; + return 0 ; +} + void pack_node_registration_status_msg ( node_registration_status_msg_t * msg, char ** buffer , uint32_t * length ) { pack32 ( msg -> timestamp , ( void ** ) buffer , length ) ; diff --git a/src/common/slurm_protocol_pack.h b/src/common/slurm_protocol_pack.h index 772fc4e095c7edef7ada7f73f50b2a21350bf40e..9f5dbc442c43096ceb205f33e4bbc0cad90231ea 100644 --- a/src/common/slurm_protocol_pack.h +++ b/src/common/slurm_protocol_pack.h @@ -57,4 +57,8 @@ void pack_node_info_msg ( slurm_msg_t * msg, void ** buf_ptr , int * buffer_size int unpack_node_info_msg ( node_info_msg_t ** msg , void ** buf_ptr , int * buffer_size ) ; int unpack_node_table_msg ( node_table_msg_t ** node , void ** buf_ptr , int * buffer_size ) ; int unpack_node_table ( node_table_msg_t * node , void ** buf_ptr , int * buffer_size ) ; + +void pack_job_allocation_response_msg ( job_allocation_response_msg_t * msg, char ** buffer , uint32_t * length ) ; + +int unpack_job_allocation_response_msg ( job_allocation_response_msg_t ** msg , char ** buffer , uint32_t * length ) ; #endif