Question

I am trying to configure Chronos to use custom mesos-docker executor present at https://github.com/mesosphere/mesos-docker/ . Everytime I try to run the command it fails.

I created the task using below command

echo '{"schedule":"R/2014-02-14T00:52:00Z/PT90M", "name":"testing_docker_executor", "command":"docker_ubuntu_test /root/docker_test.sh", "epsilon":"PT15M", "executor":"/var/lib/mesos/executors/docker" }' | http POST localhost:8080/scheduler/iso8601

I also configured logging in executor and below are the logs I get when it fails

Feb 11 13:51:36 ip6-localhost docker[13895]: Ready to serve!
Feb 11 13:51:36 ip6-localhost docker[13895]: Registered with Mesos slave
Feb 11 13:51:36 ip6-localhost docker[13895]: Task is: ct:1392126755612:2:testing_docker_executor
Feb 11 13:51:36 ip6-localhost docker[13895]: JSON from framework is rubbish
Feb 11 13:51:36 ip6-localhost docker[13895]: No JSON object could be decoded
Feb 11 13:51:36 ip6-localhost docker[13895]: Traceback (most recent call last):
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/var/lib/mesos/executors/docker", line 120, in launchTask
Feb 11 13:51:36 ip6-localhost docker[13895]:     self.data = json.loads(task.data) if task.data else {}
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
Feb 11 13:51:36 ip6-localhost docker[13895]:     return _default_decoder.decode(s)
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
Feb 11 13:51:36 ip6-localhost docker[13895]:     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/usr/lib/python2.7/json/decoder.py", line 383, in raw_decode
Feb 11 13:51:36 ip6-localhost docker[13895]:     raise ValueError("No JSON object could be decoded")
Feb 11 13:51:36 ip6-localhost docker[13895]: ValueError: No JSON object could be decoded
Feb 11 13:51:36 ip6-localhost docker[13895]: []
Feb 11 13:51:36 ip6-localhost docker[13895]: Traceback (most recent call last):
Feb 11 13:51:36 ip6-localhost docker[13895]:   File "/var/lib/mesos/executors/docker", line 67, in run
Feb 11 13:51:36 ip6-localhost docker[13895]:     img  = self.args[0]
Feb 11 13:51:36 ip6-localhost docker[13895]: IndexError: list index out of range

Is there something I am missing. Do I need to provide JSON in command.

Was it helpful?

Solution 2

I have forked and customized the mesos-docker script by @solidsnack. It can be found at https://github.com/mudasirmirza/chronos-docker

This script works perfectly fine with Mesos and Chronos without Marathon.

Usage and examples are in the readme.

OTHER TIPS

There seems to be data provided in the TaskInfo but I am not sure where this is coming from. The Docker executor expects that, if there is data provided, it was provided by Marathon, and should be JSON. Evidently something else is in there.

As regards the second error -- list index out of range -- this suggests that docker_ubuntu_test /root/docker_test.sh is not being passed to the Docker executor. Which is indeed odd.

You need to provide a docker image for mesos to run in your json. It should look more like this.

{ 
    "schedule" : "R5/2014-11-12T05:31:00.000Z/PT10S",  
    "epsilon" : "PT10M",  
    "name" : "ECHO_DATE_DOCKER",
    "container": {
    "type": "DOCKER",
    "image": "libmesos/ubuntu"
    },
    "cpus": "0.5",
    "mem": "256",   
    "command" : "date >> /tmp/ECHO_DATE_01",  
    "owner" : "chronos-user@example.com",  
    "async" : false 
}

There are more examples here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top