From f05049dd5af9a5ccee12876bee84d3ed15cd2204 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 5 Aug 2002 19:25:31 +0000 Subject: [PATCH] Return for a job step the node list rather than the node indexes. Also fix purge of defunct job steps. --- src/api/job_step_info.c | 2 +- src/common/slurm_protocol_defs.c | 2 +- src/common/slurm_protocol_pack.c | 2 +- src/slurmctld/job_mgr.c | 8 ++++---- src/slurmctld/pack.c | 16 ++++++++------- src/slurmctld/slurmctld.h | 17 +++++++--------- src/slurmctld/step_mgr.c | 35 ++++++++++++++++++++++++++++++-- 7 files changed, 56 insertions(+), 26 deletions(-) diff --git a/src/api/job_step_info.c b/src/api/job_step_info.c index e240350c1e7..d6224016151 100644 --- a/src/api/job_step_info.c +++ b/src/api/job_step_info.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * job_info.c - get/print the job step state information of slurm + * job_step_info.c - get/print the job step state information of slurm ***************************************************************************** * Copyright (C) 2002 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c index 09a48ea35a0..7b709ed6268 100644 --- a/src/common/slurm_protocol_defs.c +++ b/src/common/slurm_protocol_defs.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * slurm_protocol_defs.c - functions for initializing and releasing + * slurm_protocol_defs.c - functions for initializing and releasing * storage for RPC data structures ***************************************************************************** * Copyright (C) 2002 The Regents of the University of California. diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index cbe9e687dfc..947c60acc98 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -1,5 +1,5 @@ /****************************************************************************\ - * slurm_protocol_pack.c - functions to pack and unpack structures for RPCs + * slurm_protocol_pack.c - functions to pack and unpack structures for RPCs ***************************************************************************** * Copyright (C) 2002 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 3312c82b2a4..189b705a628 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -214,7 +214,7 @@ delete_job_details (struct job_record *job_entry) delete_job_desc_files (job_entry->job_id); if (job_entry->details->magic != DETAILS_MAGIC) - fatal ("list_delete_job: passed invalid job details pointer"); + fatal ("delete_job_details: passed invalid job details pointer"); if (job_entry->details->req_nodes) xfree(job_entry->details->req_nodes); if (job_entry->details->req_node_bitmap) @@ -1201,11 +1201,11 @@ list_delete_job (void *job_entry) delete_job_details (job_record_point); if (job_record_point->nodes) - xfree(job_record_point->nodes); + xfree (job_record_point->nodes); if (job_record_point->node_bitmap) - bit_free(job_record_point->node_bitmap); + bit_free (job_record_point->node_bitmap); if (job_record_point->step_list) - list_destroy(job_record_point->step_list); + delete_all_step_records (job_record_point); job_count--; xfree(job_record_point); } diff --git a/src/slurmctld/pack.c b/src/slurmctld/pack.c index 32ae18e67fd..ce56ac27c82 100644 --- a/src/slurmctld/pack.c +++ b/src/slurmctld/pack.c @@ -4,7 +4,7 @@ ***************************************************************************** * Copyright (C) 2002 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). - * Written by moe jette <jette1@llnl.gov>, Joseph Ekstrom (ekstrom1@llnl.gov) + * Written by Moe Jette <jette1@llnl.gov>, Joseph Ekstrom (ekstrom1@llnl.gov) * UCRL-CODE-2002-040. * * This file is part of SLURM, a resource management program. @@ -63,12 +63,14 @@ inline void buffer_realloc( void** buffer, void** current, int* size, int* len_l void pack_ctld_job_step_info( struct step_record* step, void **buf_ptr, int *buf_len) { - char node_list[BUF_SIZE]; + char *node_list; if (step->node_bitmap) - bit_fmt (node_list, BUF_SIZE, step->node_bitmap); - else + node_list = bitmap2node_name (step->node_bitmap); + else { + node_list = xmalloc(1); node_list[0] = '\0'; + } pack_job_step_info_members( step->job_ptr->job_id, @@ -80,6 +82,7 @@ pack_ctld_job_step_info( struct step_record* step, void **buf_ptr, int *buf_len buf_ptr, buf_len ); + xfree (node_list); } /* pack_ctld_job_step_info_reponse_msg - packs the message @@ -96,12 +99,11 @@ pack_ctld_job_step_info_reponse_msg( List steps, void** buffer_base, int* buffer int buffer_size = BUF_SIZE * REALLOC_MULTIPLIER; int current_size = buffer_size; void* current = NULL; - time_t current_time = time(NULL); uint32_t list_size = list_count(steps); current = *buffer_base = xmalloc( buffer_size ); - pack32( current_time, ¤t, ¤t_size ); /* FIXME What am I really suppose to put as the time?*/ - debug("job_step_count = %u\n", list_size); + debug3("job_step_count = %u\n", list_size); + pack32( last_job_update, ¤t, ¤t_size ); pack32( list_size , ¤t, ¤t_size ); /* Pack the Steps */ diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h index 9ccb2cb678b..306be775d83 100644 --- a/src/slurmctld/slurmctld.h +++ b/src/slurmctld/slurmctld.h @@ -1,5 +1,5 @@ /*****************************************************************************\ - * slurmctld.h - definitions of functions and structures for slurmcltd use + * slurmctld.h - definitions of functions and structures for slurmcltd use ***************************************************************************** * Copyright (C) 2002 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -241,18 +241,15 @@ extern struct part_record *create_part_record (void); extern struct step_record * create_step_record (struct job_record *job_ptr); /* deallocate_nodes - for a given job, deallocate its nodes and make their state IDLE */ -void deallocate_nodes (struct job_record * job_ptr); +extern void deallocate_nodes (struct job_record * job_ptr); -/* - * delete_job_details - delete a job's detail record and clear it's pointer - */ +/* delete_all_step_records - delete all step record for specified job_ptr */ +extern void delete_all_step_records (struct job_record *job_ptr); + +/* delete_job_details - delete a job's detail record and clear it's pointer */ extern void delete_job_details (struct job_record *job_entry); -/* - * delete_node_record - delete record for node with specified name - * to avoid invalidating the bitmaps and hash table, we just clear the name - * set its state to STATE_DOWN - */ +/* delete_node_record - delete record for node with specified name */ extern int delete_node_record (char *name); /* delete_part_record - delete record for partition with specified name */ diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c index da33410cb64..ab21bbacb5a 100644 --- a/src/slurmctld/step_mgr.c +++ b/src/slurmctld/step_mgr.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * step_mgr.c - manage the job step information of slurm + * step_mgr.c - manage the job step information of slurm ***************************************************************************** * Copyright (C) 2002 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). @@ -69,8 +69,39 @@ create_step_record (struct job_record *job_ptr) /* - * delete_step_record - delete record for job step for specified job_ptr and step_id + * delete_all_step_records - delete all step record for specified job_ptr * input: job_ptr - pointer to job table entry to have step record added + * output: return 0 on success, errno otherwise + */ +void +delete_all_step_records (struct job_record *job_ptr) +{ + ListIterator step_record_iterator; + struct step_record *step_record_point; + + assert (job_ptr); + step_record_iterator = list_iterator_create (job_ptr->step_list); + + while ((step_record_point = + (struct step_record *) list_next (step_record_iterator))) { + list_remove (step_record_iterator); +#ifdef HAVE_LIBELAN3 + qsw_free_jobinfo (step_record_point->qsw_job); +#endif + if (step_record_point->node_bitmap) + bit_free (step_record_point->node_bitmap); + xfree (step_record_point); + } + + list_iterator_destroy (step_record_iterator); + list_destroy (job_ptr->step_list); + job_ptr->step_list = NULL; +} + + +/* + * delete_step_record - delete record for job step for specified job_ptr and step_id + * input: job_ptr - pointer to job table entry to have step record removed * step_id - id of the desired job step * output: return 0 on success, errno otherwise */ -- GitLab