You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2016/02/04 20:09:55 UTC

mesos git commit: Clarified units (megabytes) for "disk" and "mem" resource types.

Repository: mesos
Updated Branches:
  refs/heads/master cd266e74e -> 6ab5075e2


Clarified units (megabytes) for "disk" and "mem" resource types.

Note that I also removed an old TODO from `mesos.proto`: it has been partially
implemented, and in general the need for more first-class resource values is
well-known (e.g., many JIRAs on this topic).

Review: https://reviews.apache.org/r/43124/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6ab5075e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6ab5075e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6ab5075e

Branch: refs/heads/master
Commit: 6ab5075e2c7c35c82ec7c34bd270babe3a985882
Parents: cd266e7
Author: Neil Conway <ne...@gmail.com>
Authored: Thu Feb 4 11:09:29 2016 -0800
Committer: Vinod Kone <vi...@gmail.com>
Committed: Thu Feb 4 11:09:29 2016 -0800

----------------------------------------------------------------------
 docs/attributes-resources.md | 20 +++++++++++++-------
 include/mesos/mesos.proto    | 16 ++++++++++------
 include/mesos/v1/mesos.proto | 16 ++++++++++------
 3 files changed, 33 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6ab5075e/docs/attributes-resources.md
----------------------------------------------------------------------
diff --git a/docs/attributes-resources.md b/docs/attributes-resources.md
index 53a27f4..818da8a 100644
--- a/docs/attributes-resources.md
+++ b/docs/attributes-resources.md
@@ -89,25 +89,27 @@ Note that `resourceRole` must be a valid role name; see the [roles](roles.md) do
 
 ## Predefined Uses & Conventions
 
-The Mesos master has a few resources that it pre-defines in how it handles them.  At the current time, this list consist of:
+There are several kinds of resources that have predefined behavior:
 
   - `cpus`
-  - `mem`
   - `disk`
+  - `mem`
   - `ports`
 
-In particular, a slave without `cpus` and `mem` resources will never have its resources advertised to any frameworks.  Also, the Master's user interface interprets the scalars in `mem` and `disk` in terms of *`MB`*.  IE: the value `15000` is displayed as `14.65GB`.
+Note that `disk` and `mem` resources are specified in megabytes. The master's user interface will convert resource values into a more human-readable format: for example, the value `15000` will be displayed as `14.65GB`.
+
+A slave without `cpus` and `mem` resources will not have its resources advertised to any frameworks.
 
 ## Examples
 
-Here are some examples for configuring the Mesos slaves.
+By default, Mesos will try to autodetect the resources available at the local machine when `mesos-slave` starts up. Alternatively, you can explicitly configure which resources a slave should make available.
+
+Here are some examples of how to configure the resources at a Mesos slave:
 
     --resources='cpus:24;mem:24576;disk:409600;ports:[21000-24000,30000-34000];bugs(debug_role):{a,b,c}'
 
     --resources='[{"name":"cpus","type":"SCALAR","scalar":{"value":24}},{"name":"mem","type":"SCALAR","scalar":{"value":24576}},{"name":"disk","type":"SCALAR","scalar":{"value":409600}},{"name":"ports","type":"RANGES","ranges":{"range":[{"begin":21000,"end":24000},{"begin":30000,"end":34000}]}},{"name":"bugs","type":"SET","set":{"item":["a","b","c"]},"role":"debug_role"}]'
 
-    --attributes='rack:abc;zone:west;os:centos5;level:10;keys:[1000-1500]'
-
 Or given a file `resources.txt` containing the following:
 
     [
@@ -176,7 +178,11 @@ Note: the "default role" can be set by the `--default_role` flag.
   - range called `ports`, with values `21000` through `24000` and `30000` through `34000` (inclusive)
   - set called `bugs`, with the values `a`, `b` and `c`, assigned to the role `debug_role`
 
-In the case of attributes, we end up with five attributes:
+To configure the attributes of a Mesos slave, you can use the `--attributes` command-line flag of `mesos-slave`:
+
+    --attributes='rack:abc;zone:west;os:centos5;level:10;keys:[1000-1500]'
+
+That will result in configuring the following five attributes:
 
   - `rack` with text value `abc`
   - `zone` with text value `west`

http://git-wip-us.apache.org/repos/asf/mesos/blob/6ab5075e/include/mesos/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/mesos.proto b/include/mesos/mesos.proto
index 194750e..f42a45e 100644
--- a/include/mesos/mesos.proto
+++ b/include/mesos/mesos.proto
@@ -542,13 +542,17 @@ message Attribute {
 
 
 /**
- * Describes a resource on a machine. A resource can take on one of
- * three types: scalar (double), a list of finite and discrete ranges
- * (e.g., [1-10, 20-30]), or a set of items. A resource is described
- * using the standard protocol buffer "union" trick.
+ * Describes a resource on a machine. The `name` field is a string
+ * like "cpus" or "mem" that indicates which kind of resource this is;
+ * the rest of the fields describe the properties of the resource. A
+ * resource can take on one of three types: scalar (double), a list of
+ * finite and discrete ranges (e.g., [1-10, 20-30]), or a set of
+ * items. A resource is described using the standard protocol buffer
+ * "union" trick.
  *
- * TODO(benh): Add better support for "expected" resources (e.g.,
- * cpus, memory, disk, network).
+ * Note that "disk" and "mem" resources are scalar values expressed in
+ * megabytes. Fractional "cpus" values are allowed (e.g., "0.5"),
+ * which correspond to partial shares of a CPU.
  */
 message Resource {
   required string name = 1;

http://git-wip-us.apache.org/repos/asf/mesos/blob/6ab5075e/include/mesos/v1/mesos.proto
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.proto b/include/mesos/v1/mesos.proto
index 1102bbc..415a20d 100644
--- a/include/mesos/v1/mesos.proto
+++ b/include/mesos/v1/mesos.proto
@@ -541,13 +541,17 @@ message Attribute {
 
 
 /**
- * Describes a resource on a machine. A resource can take on one of
- * three types: scalar (double), a list of finite and discrete ranges
- * (e.g., [1-10, 20-30]), or a set of items. A resource is described
- * using the standard protocol buffer "union" trick.
+ * Describes a resource on a machine. The `name` field is a string
+ * like "cpus" or "mem" that indicates which kind of resource this is;
+ * the rest of the fields describe the properties of the resource. A
+ * resource can take on one of three types: scalar (double), a list of
+ * finite and discrete ranges (e.g., [1-10, 20-30]), or a set of
+ * items. A resource is described using the standard protocol buffer
+ * "union" trick.
  *
- * TODO(benh): Add better support for "expected" resources (e.g.,
- * cpus, memory, disk, network).
+ * Note that "disk" and "mem" resources are scalar values expressed in
+ * megabytes. Fractional "cpus" values are allowed (e.g., "0.5"),
+ * which correspond to partial shares of a CPU.
  */
 message Resource {
   required string name = 1;