Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Mesos task labels to tag requests #823

Closed
apognu opened this issue Dec 28, 2015 · 5 comments
Closed

Use Mesos task labels to tag requests #823

apognu opened this issue Dec 28, 2015 · 5 comments

Comments

@apognu
Copy link

apognu commented Dec 28, 2015

Mesos 0.22 introduced task labels as a way of adding metadata to tasks.

It would be useful to be able to tag the requests in Singularity (and therefore the tasks that are spawned from its deploys) during their creation (and even afterwards). Possible use-cases would be monitoring, load-balancing or any external system that could need to select tasks by arbitrary metadata.

As far as I know, the only way to do that with Singularity would be to encode those metadata into the request name, making for rigid (and long) IDs.

Is such a feature planned or being discussed?

Regards.

@tpetr
Copy link
Contributor

tpetr commented Dec 28, 2015

We already support setting labels in the API (via #657 -- the labels field in SingularityDeploy), but labels currently do not affect task scheduling decisions and are not surfaced in the UI. We can look into adding support for that, if it's useful to you.

@apognu
Copy link
Author

apognu commented Dec 28, 2015

Oh, I did miss that in the docs.

However, when I set my labels with the following:

{
  "deploy": {
    "requestId": "demo-rec",
    "id": "4",
    "arguments": [
    ],
    "env": {
      "ENV": "staging",
      "PORT": "3000"
    },
    "containerInfo": {
      "type": "DOCKER",
      "docker": {
        "image": "my/image:latest",
        "privileged": false,
        "network": "BRIDGE",
        "portMappings": [
          {
            "containerPortType": "LITERAL",
            "containerPort": 3000,
            "hostPortType": "FROM_OFFER",
            "hostPort": 0
          }
        ]
      }
    },
    "resources": {
      "cpus": 0.1,
      "memoryMb": 16,
      "numPorts": 1
    },
    "uris": [
      "file:///etc/docker/repo.conf"
    ],
    "labels": {
      "lorem": "ipsum",
      "tags": "one,two,three"
    }
  }
}

The mesos task does not seem to be populated with them, this is what I get from /master/state.json:

"labels": [
[...]
  {
    "key": "Docker.NetworkSettings.IPAddress",
    "value": "172.17.0.3"
  }
],
[...]

Am I setting the labels properly in my deploy definition?

@apognu
Copy link
Author

apognu commented Dec 28, 2015

I'm guessing I am, since the labels are reported back in Singularity API on that request's active deploy.

Are Singularity's labels not designed to bubble up all the way to the corresponding Mesos task?

@ssalinas
Copy link
Member

Hey, thanks for pointing this out. I had honestly thought I wired this up when we moved to 0.23, but I guess I missed it. Fixed in #824 once I test and get it merged in

@tpetr
Copy link
Contributor

tpetr commented Dec 29, 2015

@apognu task label fix has been merged to master

@ssalinas ssalinas closed this as completed Jan 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants