From 85fc77f3d410bec2b830997b42e4fb033dfb924a Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Fri, 21 Dec 2007 19:34:33 +0000 Subject: [PATCH] add some comments to the node scheduling logic clean up logic to read node/job/partition state file's version --- src/slurmctld/job_mgr.c | 33 ++++++------------------------- src/slurmctld/node_mgr.c | 18 ++++------------- src/slurmctld/node_scheduler.c | 36 ++++++++++++++++++++++++---------- src/slurmctld/partition_mgr.c | 17 +++------------- 4 files changed, 39 insertions(+), 65 deletions(-) diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index 89da29930c1..42d3c025431 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -409,30 +409,9 @@ extern int load_all_job_state(void) buffer = create_buf(data, data_size); - /* - * The old header of the "job_state" file simply contained a - * timestamp, while the new header contains a "VERXXX" at the - * beginning (VER001, VER002, etc), a timestamp, and the last - * job id. To determine if we're looking at an old header or - * new header, we first check if the file begins with "VER". - * - * Each field is preceeded by two bytes which contains the field - * size. Since we are bypassing the "pack" functions in order - * see if the header contains a "VERXXX" string, we need to make - * sure that there is enough data in the buffer to compare against. - */ - if (size_buf(buffer) >= sizeof(uint32_t) + strlen(JOB_STATE_VERSION)) - { - char *ptr = get_buf_data(buffer); - - if (memcmp(&ptr[sizeof(uint32_t)], JOB_STATE_VERSION, 3) == 0) - { - safe_unpackstr_xmalloc(&ver_str, &ver_str_len, buffer); - debug3("Version string in job_state header is %s", - ver_str); - } - } - if ((!ver_str) || (strcmp(ver_str, JOB_STATE_VERSION) != 0)) { + safe_unpackstr_xmalloc(&ver_str, &ver_str_len, buffer); + debug3("Version string in job_state header is %s", ver_str); + if (strcmp(ver_str, JOB_STATE_VERSION) != 0) { error("***********************************************"); error("Can not recover job state, incompatable version"); error("***********************************************"); @@ -2830,11 +2809,11 @@ static int _validate_job_desc(job_desc_msg_t * job_desc_msg, int allocate, if (job_desc_msg->job_min_threads == (uint16_t) NO_VAL) job_desc_msg->job_min_threads = 1; /* default 1 thread per core */ if (job_desc_msg->job_min_memory == NO_VAL) - job_desc_msg->job_min_memory = 1; /* default 1MB mem per node */ + job_desc_msg->job_min_memory = 0; /* default 0MB mem per node */ if (job_desc_msg->job_max_memory == NO_VAL) - job_desc_msg->job_max_memory = 1; /* default 1MB mem per node */ + job_desc_msg->job_max_memory = 0; /* default 0MB mem per node */ if (job_desc_msg->job_min_tmp_disk == NO_VAL) - job_desc_msg->job_min_tmp_disk = 1;/* default 1MB disk per node */ + job_desc_msg->job_min_tmp_disk = 0;/* default 0MB disk per node */ return SLURM_SUCCESS; } diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c index 97c4600f09a..3f347b7ce27 100644 --- a/src/slurmctld/node_mgr.c +++ b/src/slurmctld/node_mgr.c @@ -446,20 +446,9 @@ extern int load_all_node_state ( bool state_only ) buffer = create_buf (data, data_size); - /* - * Check the data version so that when the format changes, we - * we don't try to unpack data using the wrong format routines - */ - if (size_buf(buffer) >= sizeof(uint32_t) + strlen(NODE_STATE_VERSION)) { - char *ptr = get_buf_data(buffer); - - if (memcmp( &ptr[sizeof(uint32_t)], NODE_STATE_VERSION, 3) == 0) { - safe_unpackstr_xmalloc( &ver_str, &name_len, buffer); - debug3("Version string in node_state header is %s", - ver_str); - } - } - if ((!ver_str) || (strcmp(ver_str, NODE_STATE_VERSION) != 0)) { + safe_unpackstr_xmalloc( &ver_str, &name_len, buffer); + debug3("Version string in node_state header is %s", ver_str); + if (strcmp(ver_str, NODE_STATE_VERSION) != 0) { error("*****************************************************"); error("Can not recover node state, data version incompatable"); error("*****************************************************"); @@ -468,6 +457,7 @@ extern int load_all_node_state ( bool state_only ) return EFAULT; } xfree(ver_str); + safe_unpack_time (&time_stamp, buffer); while (remaining_buf (buffer) > 0) { diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c index 5569b70aa88..204a9f5e7a9 100644 --- a/src/slurmctld/node_scheduler.c +++ b/src/slurmctld/node_scheduler.c @@ -610,7 +610,7 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, int max_feature, min_feature; bool runable_ever = false; /* Job can ever run */ bool runable_avail = false; /* Job can run with available nodes */ - uint32_t cr_enabled = 0; + static uint32_t cr_enabled = NO_VAL; int shared = 0; select_type_plugin_info_t cr_type = SELECT_TYPE_INFO_NONE; @@ -619,17 +619,24 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, return ESLURM_REQUESTED_NODE_CONFIG_UNAVAILABLE; } - /* Is Consumable Resources enabled? */ - error_code = select_g_get_info_from_plugin (SELECT_CR_PLUGIN, - &cr_enabled); - if (error_code != SLURM_SUCCESS) - return error_code; + /* Are Consumable Resources enabled? */ + if (cr_enabled == NO_VAL) { + cr_enabled = 0; /* select/linear and bluegene are no-ops */ + error_code = select_g_get_info_from_plugin (SELECT_CR_PLUGIN, + &cr_enabled); + if (error_code != SLURM_SUCCESS) { + cr_enabled = NO_VAL; + return error_code; + } + } shared = _resolve_shared_status(job_ptr->details->shared, part_ptr->max_share, cr_enabled); job_ptr->details->shared = shared; if (cr_enabled) { + /* Determine which nodes might be used by this job based upon + * its ability to share resources */ job_ptr->cr_enabled = cr_enabled; /* CR enabled for this job */ cr_type = (select_type_plugin_info_t) slurmctld_conf. @@ -660,8 +667,9 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, } if (job_ptr->details->req_node_bitmap) { /* specific nodes required */ - /* we have already confirmed that all of these nodes have a - * usable configuration and are in the proper partition */ + /* We have already confirmed that all of these nodes have a + * usable configuration and are in the proper partition. + * Check that these nodes can be used by this job. */ if (min_nodes != 0) { total_nodes = bit_set_count( job_ptr->details->req_node_bitmap); @@ -723,7 +731,9 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, if ((j >= 0) && (j > max_feature)) max_feature = j; } - + + /* Accumulate resources for this job based upon its required + * features (possibly with node counts). */ for (j = min_feature; j <= max_feature; j++) { for (i = 0; i < node_set_size; i++) { @@ -829,6 +839,8 @@ _pick_best_nodes(struct node_set *node_set_ptr, int node_set_size, avail_bitmap = backup_bitmap; } } /* for (i = 0; i < node_set_size; i++) */ + + #ifndef HAVE_BG pick_code = 1; if (job_ptr->details->req_node_bitmap && @@ -1234,6 +1246,7 @@ extern int select_nodes(struct job_record *job_ptr, bool test_only, if (max_nodes < min_nodes) { error_code = ESLURM_REQUESTED_PART_CONFIG_UNAVAILABLE; } else { + /* Select resources for the job here */ error_code = _get_req_features(node_set_ptr, node_set_size, &select_bitmap, job_ptr, part_ptr, min_nodes, max_nodes, @@ -1471,6 +1484,9 @@ static int _build_feature_list(struct job_record *job_ptr) /* * _build_node_list - identify which nodes could be allocated to a job + * based upon node features, memory, processors, etc. Note that a + * bitmap is set to indicate which of the job's features that the + * nodes satisfy. * IN job_ptr - pointer to node to be scheduled * OUT node_set_pptr - list of node sets which could be used for the job * OUT node_set_size - number of node_set entries @@ -1836,7 +1852,7 @@ extern void build_node_details(struct job_record *job_ptr) * _valid_features("[fs1|fs2|fs3|fs4]", "fs3") returns a bitmap with * the third bit set. For another example * _valid_features("[fs1|fs2|fs3|fs4]", "fs1,fs3") returns a bitmap - * with the first and third bits set. This function returns a bitmap + * with the first and third bits set. The function returns a bitmap * with the first bit set if requirements are satisfied without a * mutually exclusive feature list. */ diff --git a/src/slurmctld/partition_mgr.c b/src/slurmctld/partition_mgr.c index b85da32dd2a..189e3949e54 100644 --- a/src/slurmctld/partition_mgr.c +++ b/src/slurmctld/partition_mgr.c @@ -438,20 +438,9 @@ int load_all_part_state(void) buffer = create_buf(data, data_size); - /* - * Check the data version so that when the format changes, we - * we don't try to unpack data using the wrong format routines - */ - if (size_buf(buffer) >= sizeof(uint32_t) + strlen(PART_STATE_VERSION)) { - char *ptr = get_buf_data(buffer); - - if (memcmp( &ptr[sizeof(uint32_t)], PART_STATE_VERSION, 3) == 0) { - safe_unpackstr_xmalloc( &ver_str, &name_len, buffer); - debug3("Version string in part_state header is %s", - ver_str); - } - } - if ((!ver_str) || (strcmp(ver_str, PART_STATE_VERSION) != 0)) { + safe_unpackstr_xmalloc( &ver_str, &name_len, buffer); + debug3("Version string in part_state header is %s", ver_str); + if (strcmp(ver_str, PART_STATE_VERSION) != 0) { error("**********************************************************"); error("Can not recover partition state, data version incompatable"); error("**********************************************************"); -- GitLab