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 528 forks source link

Is there any way to run a command in all nodes at once? #649

Open Spritekin opened 8 years ago

Spritekin commented 8 years ago

Would be awesome. I.E. as a replacement instead of having to install jobs on each slave (i.e. for container cleanup).

Kulikowski commented 8 years ago

That would be great, I would love that.

xiaods commented 8 years ago

use mesos constraints to limited?

Spritekin commented 8 years ago

Sorry xiaods... don't understand what you mean...

Rob-Johnson commented 8 years ago

@Spritekin there is no way of expressing 'on this schedule, launch multiple tasks'.

However, you could doing this by having multiple jobs (named according to the host they run on) and as @xiaods suggested, setting a 'hostname' constraint. The job definition would look something like:

{
  "name": "cleanup-task-my-mesos-agent",
  "constraints": [["hostname", "EQUALS", "my-mesos-agent"]]
  "command": "cleanup..."
}

where my-mesos-agent is a hostname. You'd need one job per host, replacing my-mesos-agent accordingly.

Spritekin commented 8 years ago

@Rob-Johnson Thanks, but unfortunately that doesn't work when my nodes (and IPs) keep changing due to autoscaling.

batizty commented 7 years ago

@Rob-Johnson Hi Rob, I start to use Chronos and want to run same command on all nodes in my cluster. Below is my job submitted through REST API.

{ "name": "13", "command": "echo date >> /tmp/13.chronos-work.log", "shell": true, "epsilon": "PT1M", "executor": "", "executorFlags": "", "retries": 2, "owner": "tuoyu@staff.weibo.com", "async": false, "cpus": 1.0, "uris": [], "schedule": "R/2014-03-08T20:00:00.000Z/PT1M", "constraints": [ ["group", "EQUALS", "group1"] ] }

All the nodes in my cluster, I setted up with '--attributes=node_name:node1;group:group1'.

The job 13 should be on all nodes with 'group1' attribute, but actually, expect the first running i forced run this job through UI button 'force run', later task were all run in only one node not all nodes.

Below is the software version on my CentOS 7.1. Name : chronos Arch : x86_64 Version : 2.4.0 Release : 0.1.20151007110204.el7 Size : 35 M Repo : installed From repo : mesosphere Summary : Fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules URL : https://github.com/mesos/chronos License : Apache-2.0 Description : Fault tolerant job scheduler for Mesos which handles dependencies and ISO8601 based schedules

Name : mesos Arch : x86_64 Version : 1.0.1 Release : 2.0.93.centos701406 Size : 142 M Repo : installed From repo : mesosphere Summary : Cluster resource manager with efficient resource isolation URL : https://mesos.apache.org/ License : Apache-2.0 Description : Cluster resource manager with efficient resource isolation : Apache Mesos is a cluster manager that offers efficient resource isolation : and sharing across distributed applications, or frameworks. It can run : Hadoop, MPI, Hypertable, Spark (a new framework for low-latency interactive : and iterative jobs), and other applications.

I am not sure what's wrong with it, and could you please give some help about how to run a job on all nodes in cluster through Chronos?

Thanks.

By the way, I like Chronos, and I am working on modify the chronos to satisfy my corp environment. It is cool !

Rob-Johnson commented 7 years ago

@batizty Chronos will only run the task on one host: that is, your constraint means that Chronos will make sure that the one host it picks to run the task on will have the correct 'group' attribute, not that it will run the task on all hosts with the correct group attribute.

batizty commented 7 years ago

@Rob-Johnson Thanks for your reply.

You mean that there is no way to 'run a command in all nodes at once' by now through chronos in cluster, am I right, just to reconfirm.

Thank you very much.

ydp commented 7 years ago

I want the same too

junneyang commented 6 years ago

I want the same too