Newer
Older
*msg = xmalloc ( sizeof ( job_info_msg_t ) );
if ( *msg == NULL )
return ENOMEM ;
/* load buffer's header (data structure version and time) */
unpack32 (&((*msg) -> record_count), buf_ptr, buffer_size);
unpack32 (&((*msg) -> last_update ) , buf_ptr, buffer_size);
job = (*msg) -> job_array = xmalloc ( sizeof ( job_info_t ) * (*msg)->record_count ) ;
/* load individual job info */
for (i = 0; i < (*msg)->record_count ; i++) {
int unpack_job_info ( job_info_t ** msg , void ** buf_ptr , int * buffer_size )
int unpack_job_info_members ( job_info_t * job , void ** buf_ptr , int * buffer_size )
{
uint16_t uint16_tmp;
uint32_t uint32_tmp;
char * node_inx_str;
unpack32 (&job->job_id, buf_ptr, buffer_size);
unpack32 (&job->user_id, buf_ptr, buffer_size);
unpack16 (&job->job_state, buf_ptr, buffer_size);
unpack32 (&job->time_limit, buf_ptr, buffer_size);
unpack32 (&uint32_tmp, buf_ptr, buffer_size);
job->start_time = (time_t) uint32_tmp;
unpack32 (&uint32_tmp, buf_ptr, buffer_size);
job->end_time = (time_t) uint32_tmp;
unpack32 (&job->priority, buf_ptr, buffer_size);
unpackstr_xmalloc (&job->nodes, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&job->partition, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&job->name, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&node_inx_str, &uint16_tmp, buf_ptr, buffer_size);
job->node_inx = bitfmt2int("");
else {
job->node_inx = bitfmt2int(node_inx_str);
xfree ( node_inx_str );
}
unpack32 (&job->num_procs, buf_ptr, buffer_size);
unpack32 (&job->num_nodes, buf_ptr, buffer_size);
unpack16 (&job->shared, buf_ptr, buffer_size);
unpack16 (&job->contiguous, buf_ptr, buffer_size);
unpack32 (&job->min_procs, buf_ptr, buffer_size);
unpack32 (&job->min_memory, buf_ptr, buffer_size);
unpack32 (&job->min_tmp_disk, buf_ptr, buffer_size);
unpackstr_xmalloc (&job->req_nodes, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&node_inx_str, &uint16_tmp, buf_ptr, buffer_size);
job->req_node_inx = bitfmt2int("");
else {
unpackstr_xmalloc (&job->features, &uint16_tmp, buf_ptr, buffer_size);

tewk
committed
}
void pack_slurm_ctl_conf ( slurm_ctl_conf_info_msg_t * build_ptr, void ** buf_ptr , int * buffer_size )
pack32 (build_ptr->last_update, buf_ptr, buffer_size);
packstr (build_ptr->backup_controller, buf_ptr, buffer_size);
packstr (build_ptr->control_machine, buf_ptr, buffer_size);
packstr (build_ptr->epilog, buf_ptr, buffer_size);
pack16 (build_ptr->fast_schedule, buf_ptr, buffer_size);
pack16 (build_ptr->hash_base, buf_ptr, buffer_size);
pack16 (build_ptr->heartbeat_interval, buf_ptr, buffer_size);
pack16 (build_ptr->kill_wait, buf_ptr, buffer_size);
packstr (build_ptr->prioritize, buf_ptr, buffer_size);
packstr (build_ptr->prolog, buf_ptr, buffer_size);
pack16 (build_ptr->slurmctld_timeout, buf_ptr, buffer_size);
pack16 (build_ptr->slurmd_timeout, buf_ptr, buffer_size);
packstr (build_ptr->slurm_conf, buf_ptr, buffer_size);
packstr (build_ptr->state_save_location, buf_ptr, buffer_size);
packstr (build_ptr->tmp_fs, buf_ptr, buffer_size);
}
int unpack_slurm_ctl_conf ( slurm_ctl_conf_info_msg_t **build_buffer_ptr, void ** buffer , int * buffer_size )
{
uint16_t uint16_tmp;
slurm_ctl_conf_info_msg_t * build_ptr ;
/* alloc memory for structure */
build_ptr = xmalloc ( sizeof ( slurm_ctl_conf_t ) ) ;
if (build_ptr == NULL)
{
return ENOMEM;
}
/* load the data values */
/* unpack timestamp of snapshot */
unpack32 (&build_ptr->last_update, buffer, buffer_size);
unpackstr_xmalloc (&build_ptr->backup_controller, &uint16_tmp, buffer, buffer_size);
unpackstr_xmalloc (&build_ptr->control_machine, &uint16_tmp, buffer, buffer_size);
unpackstr_xmalloc (&build_ptr->epilog, &uint16_tmp, buffer, buffer_size);
unpack16 (&build_ptr->fast_schedule, buffer, buffer_size);
unpack16 (&build_ptr->hash_base, buffer, buffer_size);
unpack16 (&build_ptr->heartbeat_interval, buffer, buffer_size);
unpack16 (&build_ptr->kill_wait, buffer, buffer_size);
unpackstr_xmalloc (&build_ptr->prioritize, &uint16_tmp, buffer, buffer_size);
unpackstr_xmalloc (&build_ptr->prolog, &uint16_tmp, buffer, buffer_size);
unpack16 (&build_ptr->slurmctld_timeout, buffer, buffer_size);
unpack16 (&build_ptr->slurmd_timeout, buffer, buffer_size);
unpackstr_xmalloc (&build_ptr->slurm_conf, &uint16_tmp, buffer, buffer_size);
unpackstr_xmalloc (&build_ptr->state_save_location, &uint16_tmp, buffer, buffer_size);
unpackstr_xmalloc (&build_ptr->tmp_fs, &uint16_tmp, buffer, buffer_size);
*build_buffer_ptr = build_ptr ;
return 0 ;
/* pack_job_desc
* packs a job_desc struct
* header - the body structure to pack
* buf_ptr - destination of the pack, note buffer will be incremented by underlying pack routines
* buffer_size - length of buffer, note length will be decremented by underlying pack routines
*/
void pack_job_desc ( job_desc_msg_t * job_desc_ptr, void ** buf_ptr , int * buffer_size )
{
/* load the data values */
/* unpack timestamp of snapshot */
pack16 (job_desc_ptr->contiguous, buf_ptr, buffer_size);
packstr (job_desc_ptr->features, buf_ptr, buffer_size);
packstr (job_desc_ptr->groups, buf_ptr, buffer_size);
pack32 (job_desc_ptr->job_id, buf_ptr, buffer_size);
packstr (job_desc_ptr->name, buf_ptr, buffer_size);
if (job_desc_ptr->partition_key)
packmem (job_desc_ptr->partition_key, 32, buf_ptr, buffer_size);
else {
char *no_key;
no_key = xmalloc (32);
packmem (no_key, 32, buf_ptr, buffer_size);
xfree (no_key);
}
pack32 (job_desc_ptr->min_procs, buf_ptr, buffer_size);
pack32 (job_desc_ptr->min_memory, buf_ptr, buffer_size);
pack32 (job_desc_ptr->min_tmp_disk, buf_ptr, buffer_size);
packstr (job_desc_ptr->partition, buf_ptr, buffer_size);
pack32 (job_desc_ptr->priority, buf_ptr, buffer_size);
packstr (job_desc_ptr->req_nodes, buf_ptr, buffer_size);
packstring_array (job_desc_ptr->environment, job_desc_ptr->env_size, buf_ptr, buffer_size);
packstr (job_desc_ptr->script, buf_ptr, buffer_size);
packstr (job_desc_ptr->stderr, buf_ptr, buffer_size);
packstr (job_desc_ptr->stdin, buf_ptr, buffer_size);
packstr (job_desc_ptr->stdout, buf_ptr, buffer_size);
packstr (job_desc_ptr->work_dir, buf_ptr, buffer_size);
pack16 (job_desc_ptr->shared, buf_ptr, buffer_size);
pack32 (job_desc_ptr->time_limit, buf_ptr, buffer_size);
pack32 (job_desc_ptr->num_procs, buf_ptr, buffer_size);
pack32 (job_desc_ptr->num_nodes, buf_ptr, buffer_size);
pack32 (job_desc_ptr->user_id, buf_ptr, buffer_size);
* unpacks a job_desc struct
* header - the body structure to unpack
* buf_ptr - destination of the pack, note buffer will be incremented by underlying unpack routines
* buffer_size - length of buffer, note length will be decremented by underlying unpack routines
*/
int unpack_job_desc ( job_desc_msg_t **job_desc_buffer_ptr, void ** buf_ptr , int * buffer_size )
{
uint16_t uint16_tmp;
job_desc_msg_t * job_desc_ptr ;
/* alloc memory for structure */
job_desc_ptr = xmalloc ( sizeof ( job_desc_msg_t ) ) ;
if (job_desc_ptr== NULL)
{
return ENOMEM ;
}
/* load the data values */
/* unpack timestamp of snapshot */
unpack16 (&job_desc_ptr->contiguous, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->features, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->groups, &uint16_tmp, buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->job_id, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->name, &uint16_tmp, buf_ptr, buffer_size);
unpackmem_xmalloc ( ( char ** ) &job_desc_ptr->partition_key, &uint16_tmp,
buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->min_procs, buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->min_memory, buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->min_tmp_disk, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->partition, &uint16_tmp, buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->priority, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->req_nodes, &uint16_tmp, buf_ptr, buffer_size);
unpackstring_array (&job_desc_ptr->environment, &job_desc_ptr->env_size, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->script, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->stderr, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->stdin, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->stdout, &uint16_tmp, buf_ptr, buffer_size);
unpackstr_xmalloc (&job_desc_ptr->work_dir, &uint16_tmp, buf_ptr, buffer_size);
unpack16 (&job_desc_ptr->shared, buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->time_limit, buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->num_procs, buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->num_nodes, buf_ptr, buffer_size);
unpack32 (&job_desc_ptr->user_id, buf_ptr, buffer_size);
*job_desc_buffer_ptr = job_desc_ptr ;
return 0 ;
}
void pack_last_update ( last_update_msg_t * msg , void ** buffer , uint32_t * length )
{
pack32 ( msg -> last_update , buffer , length ) ;
}
int unpack_last_update ( last_update_msg_t ** msg , void ** buffer , uint32_t * length )
{
last_update_msg_t * last_update_msg ;
last_update_msg = xmalloc ( sizeof ( last_update_msg_t ) ) ;
if ( last_update_msg == NULL)
{
*msg = NULL ;
return ENOMEM ;
}
unpack32 ( & last_update_msg -> last_update , buffer , length ) ;
*msg = last_update_msg ;
return 0 ;
void pack_return_code ( return_code_msg_t * msg , void ** buffer , uint32_t * length )
{
pack32 ( msg -> return_code , buffer , length ) ;
}
int unpack_return_code ( return_code_msg_t ** msg , void ** buffer , uint32_t * length )
{
return_code_msg_t * return_code_msg ;
return_code_msg = xmalloc ( sizeof ( return_code_msg_t ) ) ;
if ( return_code_msg == NULL)
{
*msg = NULL ;
return ENOMEM ;
}
unpack32 ( & return_code_msg -> return_code , buffer , length ) ;
*msg = return_code_msg ;
return 0 ;
}
void pack_reattach_tasks_streams_msg ( reattach_tasks_streams_msg_t * msg , void ** buffer , uint32_t * length )
{
pack32 ( msg -> job_id , buffer , length ) ;
pack32 ( msg -> job_step_id , buffer , length ) ;
pack32 ( msg -> uid , buffer , length ) ;
pack_job_credential ( msg -> credential , buffer , length ) ;
pack32 ( msg -> tasks_to_reattach , buffer , length ) ;
slurm_pack_slurm_addr ( & msg -> streams , buffer , length ) ;
pack32_array ( msg -> global_task_ids , ( uint16_t ) msg -> tasks_to_reattach , buffer , length ) ;
}
int unpack_reattach_tasks_streams_msg ( reattach_tasks_streams_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
{
uint16_t uint16_tmp;
reattach_tasks_streams_msg_t * msg ;
msg = xmalloc ( sizeof ( reattach_tasks_streams_msg_t ) ) ;
if (msg == NULL)
{
*msg_ptr = NULL ;
return ENOMEM ;
}
unpack32 ( & msg -> job_id , buffer , length ) ;
unpack32 ( & msg -> job_step_id , buffer , length ) ;
unpack32 ( & msg -> uid , buffer , length ) ;
unpack_job_credential( & msg -> credential , buffer , length ) ;
unpack32 ( & msg -> tasks_to_reattach , buffer , length ) ;
slurm_unpack_slurm_addr_no_alloc ( & msg -> streams , buffer , length ) ;
unpack32_array ( & msg -> global_task_ids , & uint16_tmp , buffer , length ) ;
*msg_ptr = msg ;
return 0 ;
}
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
void pack_task_exit_msg ( task_exit_msg_t * msg , void ** buffer , uint32_t * length )
{
pack32 ( msg -> task_id , buffer , length ) ;
pack32 ( msg -> return_code , buffer , length ) ;
}
int unpack_task_exit_msg ( task_exit_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
{
task_exit_msg_t * msg ;
msg = xmalloc ( sizeof ( launch_tasks_response_msg_t ) ) ;
if (msg == NULL)
{
*msg_ptr = NULL ;
return ENOMEM ;
}
unpack32 ( & msg -> task_id , buffer , length ) ;
unpack32 ( & msg -> return_code , buffer , length ) ;
*msg_ptr = msg ;
return 0 ;
}
void pack_launch_tasks_response_msg ( launch_tasks_response_msg_t * msg , void ** buffer , uint32_t * length )
{
pack32 ( msg -> return_code , buffer , length ) ;
packstr ( msg -> node_name , buffer , length ) ;
}
int unpack_launch_tasks_response_msg ( launch_tasks_response_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
{
uint16_t uint16_tmp;
launch_tasks_response_msg_t * msg ;
msg = xmalloc ( sizeof ( launch_tasks_response_msg_t ) ) ;
if (msg == NULL)
{
*msg_ptr = NULL ;
return ENOMEM ;
}
unpack32 ( & msg -> return_code , buffer , length ) ;
unpackstr_xmalloc ( & msg -> node_name , & uint16_tmp , buffer , length ) ;
*msg_ptr = msg ;
return 0 ;
}
void pack_launch_tasks_request_msg ( launch_tasks_request_msg_t * msg , void ** buffer , uint32_t * length )
{
pack32 ( msg -> job_id , buffer , length ) ;
pack32 ( msg -> job_step_id , buffer , length ) ;
pack32 ( msg -> uid , buffer , length ) ;
pack_job_credential ( msg -> credential , buffer , length ) ;
pack32 ( msg -> tasks_to_launch , buffer , length ) ;

tewk
committed
packstring_array ( msg -> env , msg -> envc , buffer , length ) ;
packstr ( msg -> cwd , buffer , length ) ;
packstring_array ( msg -> argv , msg -> argc , buffer , length ) ;
slurm_pack_slurm_addr ( & msg -> response_addr , buffer , length ) ;
slurm_pack_slurm_addr ( & msg -> streams , buffer , length ) ;
pack32_array ( msg -> global_task_ids , ( uint16_t ) msg -> tasks_to_launch , buffer , length ) ;
int unpack_launch_tasks_request_msg ( launch_tasks_request_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
launch_tasks_request_msg_t * msg ;
msg = xmalloc ( sizeof ( launch_tasks_request_msg_t ) ) ;
if (msg == NULL)
{
*msg_ptr = NULL ;
return ENOMEM ;
}
unpack32 ( & msg -> job_id , buffer , length ) ;
unpack32 ( & msg -> job_step_id , buffer , length ) ;
unpack32 ( & msg -> uid , buffer , length ) ;
unpack_job_credential( & msg -> credential , buffer , length ) ;
unpack32 ( & msg -> tasks_to_launch , buffer , length ) ;

tewk
committed
unpackstring_array ( & msg -> env , & msg -> envc , buffer , length ) ;
unpackstr_xmalloc ( & msg -> cwd , & uint16_tmp , buffer , length ) ;
unpackstring_array ( & msg -> argv , & msg->argc , buffer , length ) ;
slurm_unpack_slurm_addr_no_alloc ( & msg -> response_addr , buffer , length ) ;
slurm_unpack_slurm_addr_no_alloc ( & msg -> streams , buffer , length ) ;
unpack32_array ( & msg -> global_task_ids , & uint16_tmp , buffer , length ) ;
*msg_ptr = msg ;
return 0 ;
}
void pack_cancel_tasks_msg ( kill_tasks_msg_t * msg , void ** buffer , uint32_t * length )
{
pack32 ( msg -> job_id , buffer , length ) ;
pack32 ( msg -> job_step_id , buffer , length ) ;
int unpack_cancel_tasks_msg ( kill_tasks_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
msg = xmalloc ( sizeof ( kill_tasks_msg_t ) ) ;
if ( msg == NULL)
{
*msg_ptr = NULL ;
return ENOMEM ;
}
unpack32 ( & msg -> job_id , buffer , length ) ;
unpack32 ( & msg -> job_step_id , buffer , length ) ;
*msg_ptr = msg ;
return 0 ;
}
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
void pack_cancel_job_step_msg ( job_step_id_msg_t * msg , void ** buffer , uint32_t * length )
{
pack32 ( msg -> job_id , buffer , length ) ;
pack32 ( msg -> job_step_id , buffer , length ) ;
}
int unpack_cancel_job_step_msg ( job_step_id_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
{
job_step_id_msg_t * msg ;
msg = xmalloc ( sizeof ( job_step_id_msg_t ) ) ;
if ( msg == NULL)
{
*msg_ptr = NULL ;
return ENOMEM ;
}
unpack32 ( & msg -> job_id , buffer , length ) ;
unpack32 ( & msg -> job_step_id , buffer , length ) ;
*msg_ptr = msg ;
return 0 ;
}
void pack_ ( * msg , void ** buffer , uint32_t * length )
assert ( msg != NULL );
pack16 ( msg -> , buffer , length ) ;
pack32 ( msg -> , buffer , length ) ;
void unpack_ ( ** msg_ptr , void ** buffer , uint32_t * length )
uint16_t uint16_tmp;
assert ( msg_ptr != NULL );
msg = xmalloc ( sizeof ( ) ) ;
{
return ;
}
unpack16 ( & msg -> , buffer , length ) ;
unpack32 ( & msg -> , buffer , length ) ;
unpackstr_xmalloc ( & msg -> , & uint16_tmp , buffer , length ) ;
*msg_ptr = msg ;
void pack_slurm_addr_array ( slurm_addr * slurm_address , uint16_t size_val, void ** buffer , int * length )
{
int i=0;
uint16_t nl = htons(size_val);
for ( i=0; i < size_val; i++ )
{
slurm_pack_slurm_addr ( slurm_address + i , buffer , length ) ;
}
}
void unpack_slurm_addr_array ( slurm_addr ** slurm_address , uint16_t * size_val , void ** buffer , int * length )
{
int i=0;
uint16_t nl ;
unpack16( & nl , buffer , length );
*size_val = ntohs ( nl ) ;
*slurm_address = xmalloc( (*size_val) * sizeof( slurm_addr ) );