Search code examples
mesosmesospheredcos

Marathon: Placement Constraints in Mesosphere Jobs


How can I add Placement Constraints in mesosphere jobs?
I know there a GUI way to add this to Services and what I need is how can I do the same to JOBS?


Solution

  • This is possible but maybe not exposed in GUI. See below example from readme

    {
       "id": "sample-job",
       "description": "A sample job that sleeps",
       "run": {
       "cmd": "sleep 1000",
       "cpus": 0.01,
       "mem": 32,
       "disk": 0,
       "placement": {
           "constraints": [
        {
            "attribute": "hostname",
            "operator": "LIKE",
            "value": "<host-name>"
        }
           ]
       }
       },
       "schedules": [
            {
                "id": "sample-schedule",
                "enabled": true,
                "cron": "0 0 * * *",
                "concurrencyPolicy": "ALLOW"
            }
        ]
    }