Change "cpu" consumable resource to "n_cpu", as it conflicts with the built-in
@@ -40,6 +40,9 @@ function add_consumable_sge_resource {
_CONFIG_FILE=/tmp/complex_${_CURRENT_EXEC_NODE_NAME}.txt
qconf -sc > "$_CONFIG_FILE"
+ # First remove any line, which start with the resource name, in case it already exists
+ # Otherwise - resource won't be added/modified
+ sed -i "/^$RESOURCE_NAME /d" "$_CONFIG_FILE"
echo "$RESOURCE_NAME $RESOURCE_NAME $RESOURCE_TYPE <= YES YES $RESOURCE_DEFAULT 0" >> "$_CONFIG_FILE"
qconf -Mc "$_CONFIG_FILE"
rm "$_CONFIG_FILE"
@@ -83,7 +86,18 @@ pipe_log_info "$_NODE_RAM_COUNT RAM found" "$_SGE_RESOURCES_SETUP_TASK"
if [ -z "$_NODE_CPU_COUNT" ]; then
_NODE_CPU_COUNT=$(nproc)
fi
-CP_CAP_GE_CONSUMABLE_RESOURCE_NAME_CPU=${CP_CAP_GE_CONSUMABLE_RESOURCE_NAME_CPU:-cpu}
+# Using "n_cpu", which is a number of available CPUs == slots, instead of "cpu" here as:
+# "cpu" is a "built in" resource
+# It is automatically calculated, based on the real cpu utilization in %% (reported by the "load_values"), e.g.:
+# ```
+# $ qconf -se pipeline-46089
+# hostname pipeline-46089
+# complex_values ram=7G
+# load_values load_avg=10.740000,load_short=10.620000, \
+# ...
+# virtual_used=1466.832031M,cpu=100.000000
+# ```
+CP_CAP_GE_CONSUMABLE_RESOURCE_NAME_CPU=${CP_CAP_GE_CONSUMABLE_RESOURCE_NAME_CPU:-n_cpu}
pipe_log_info "$_NODE_CPU_COUNT CPUs found" "$_SGE_RESOURCES_SETUP_TASK"
pipe_log_info "Starting GridEngine resources configuration..." "$_SGE_RESOURCES_SETUP_TASK"
@@ -94,6 +108,6 @@ then
fi
configure_consumable_sge_resource "$CP_CAP_GE_CONSUMABLE_RESOURCE_NAME_RAM" "MEMORY" "0G" "$_NODE_RAM_COUNT"
-configure_consumable_sge_resource "$CP_CAP_GE_CONSUMABLE_RESOURCE_NAME_CPU" "DOUBLE" "0" "$_NODE_CPU_COUNT"
+configure_consumable_sge_resource "$CP_CAP_GE_CONSUMABLE_RESOURCE_NAME_CPU" "INT" "0" "$_NODE_CPU_COUNT"
pipe_log_success "Finished GridEngine resources configuration" "$_SGE_RESOURCES_SETUP_TASK"
