Newer
Older
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 ;
}
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 ;
}
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
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 ) );