Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/928#discussion_r143081467
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/rm/AbstractResourceManager.java
---
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.work.foreman.rm;
+
+import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.exec.ExecConstants;
+import org.apache.drill.exec.server.DrillbitContext;
+
+/**
+ * Abstract base class for a resource manager. Handles tasks common to all
+ * resource managers: learning the resources available on this Drillbit.
+ * In the current version, Drillbits must be symmetrical, so that knowing
+ * the resources on one node is sufficient to know resources available on
+ * all nodes.
+ */
+
+public abstract class AbstractResourceManager implements ResourceManager {
+
+ protected final DrillbitContext context;
+ private final long memoryPerNode;
+ private final int cpusPerNode;
+
+ public AbstractResourceManager(final DrillbitContext context) {
+ this.context = context;
+ DrillConfig config = context.getConfig();
+
+ // Normally we use the actual direct memory configured on the JVM
command
+ // line. However, if the config param is set, we use that instead (if
it is
+ // lower than actual memory). Primarily for testing.
+
+ long memLimit = DrillConfig.getMaxDirectMemory();
+ long configMemoryPerNode =
config.getBytes(ExecConstants.MAX_MEMORY_PER_NODE);
--- End diff --
Actually, `getBytes()` allows the value to be expressed as `128 MB` or '2
GB` instead of the ridiculously long numbers we've used elsewhere.
---