mesos / chronos

Fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules
http://mesos.github.io/chronos/
Apache License 2.0
4.39k stars 529 forks source link

Chronos should not add invalid characters to the Task ID #568

Open tdooner opened 9 years ago

tdooner commented 9 years ago

The TaskUtils.getTaskId method adds the values of the arguments array to the end of the task ID.

This makes for more-readable IDs in the case of common arguments like -v, but Mesos considers / to be an invalid character in Task ID. This prevents me from a job configuration like:

"command": "cat",
"arguments": ["/etc/passwd"],

Mesos master (0.23.0) logs the following:

I1001 16:35:05.784687  5022 master.cpp:3792] Sending status update TASK_ERROR (UUID: [snip]) for task ct:1443717301964:0:my_chronos_job_name:cat /etc/password of framework 20150714-191408-4163031306-5050-1590-0001 'TaskID 'ct:1443717301964:0:my_chronos_job:cat /etc/passwd' contains invalid characters'

In my opinion, Chronos should either:

  1. Strip invalid characters from the Task ID, or
  2. Not add the arguments array to the Task ID in the first place

Since I don't see the benefit from adding the arguments, and the arguments can be quite long, I would prefer the second option. But whatever, I'd be happy with simply being able to use slashes in the arguments array. Thanks.

Saurabh2004in commented 9 years ago

Agree, If you get any quick resolution for the same, please post it. This is deal breaker for us.

gomes commented 9 years ago

Agree with the second point too, put arguments as part of Task ID value is useless.

tdooner commented 9 years ago

@Saurabh2004in I'm hacking around it by simply not using the arguments array, and instead putting them as part of the command, e.g.:

  "shell": true,    // (the default)
  "command": "cat /etc/passwd"

However, this breaks when your Docker image has a custom entrypoint. In that case, I have no good resolution.

gomes commented 9 years ago

@tdooner @Saurabh2004in arguments should be used when you use entrypoint in your docker container.

asottile commented 8 years ago

Arguments are also incredibly useful when you want to avoid having a shell as pid1 inside your container (making it difficult to respond to signals). Seems the default is to run sh -c '{command}'. We're currently working around with command: "exec dumb-init ..." but this is non-ideal...

pbnsilva commented 8 years ago

Has anyone found a workaround for the cases where I need to pass the arguments to the Docker entrypoint?

mcoffin commented 8 years ago

@pbnsilva I think most people are just calling the real entrypoint via bash as a temporary workaround.

mindscratch commented 7 years ago

I'm using @tdooner's solution:

  "shell": true,    // (the default)
  "command": "cat /etc/passwd"
dcvan24 commented 6 years ago

The problem is that Chronos concatenates job arguments with space in Mesos task ID, which is not allowed. To workaround the issue, you can change the taskIdTemplate in src/main/scala/org/apache/mesos/chronos/scheduler/jobs/TaskUtils.scala to discard arguments in the task ID.