Repository: mesos Updated Branches: refs/heads/master 5a198ee92 -> 9dd1e74d6
Added labels documentation. Added labels documentation to the framework development guide. Review: https://reviews.apache.org/r/37779 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9dd1e74d Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9dd1e74d Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9dd1e74d Branch: refs/heads/master Commit: 9dd1e74d6b3a67e89ba3bbceb8cd538e1cfe256a Parents: 5a198ee Author: Niklas Nielsen <[email protected]> Authored: Wed Aug 26 10:50:31 2015 -0700 Committer: Niklas Q. Nielsen <[email protected]> Committed: Wed Aug 26 10:50:31 2015 -0700 ---------------------------------------------------------------------- docs/app-framework-development-guide.md | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/9dd1e74d/docs/app-framework-development-guide.md ---------------------------------------------------------------------- diff --git a/docs/app-framework-development-guide.md b/docs/app-framework-development-guide.md index db0181c..bada7fe 100644 --- a/docs/app-framework-development-guide.md +++ b/docs/app-framework-development-guide.md @@ -210,6 +210,67 @@ You need to put your framework somewhere that all slaves on the cluster can get Once you are sure that your executors are available to the mesos-slaves, you should be able to run your scheduler, which will register with the Mesos master, and start receiving resource offers! + +## Labels + +`Labels` can be found in the `TaskInfo`, `DiscoveryInfo` and `TaskStatus`s and +let's framework and module writers use Labels to tag and pass unstructured +information around Mesos. Labels are free-form key-value pairs supplied by the +framework scheduler or label decorator hooks. Below is the protobuf definitions +of labels: + +~~~{.proto} + optional Labels labels = 11; +~~~ + +~~~{.proto} +/** + * Collection of labels. + */ +message Labels { + repeated Label labels = 1; +} + +/** + * Key, value pair used to store free form user-data. + */ +message Label { + required string key = 1; + optional string value = 2; +} +~~~ + +Labels are not interpreted by Mesos itself, but will be made available over +master and slave state endpoints. Further more, the executor and scheduler can +introspect labels on the TaskInfo and TaskStatus programmatically. +Below is an example of how two label pairs (`"environment": "prod"` and +`"bananas": "apples"`) can be fetched from the master state endpoint. + + +~~~{.sh} +$ curl http://master/state.json +... +{ + "executor_id": "default", + "framework_id": "20150312-120017-16777343-5050-39028-0000", + "id": "3", + "labels": [ + { + "key": "environment", + "value": "prod" + }, + { + "key": "bananas", + "value": "apples" + } + ], + "name": "Task 3", + "slave_id": "20150312-115625-16777343-5050-38751-S0", + "state": "TASK_FINISHED", + ... +}, +~~~ + ## Service discovery When your framework registers an executor or launches a task, it can provide additional information for service discovery. This information is stored by the Mesos master along with other imporant information such as the slave currently running the task. A service discovery system can programmatically retrieve this information in order to set up DNS entries, configure proxies, or update any consistent store used for service discovery in a Mesos cluster that runs multiple frameworks and multiple tasks.
