chronos icon indicating copy to clipboard operation
chronos copied to clipboard

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

Open Spritekin opened this issue 8 years ago • 10 comments

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

Spritekin avatar Mar 08 '16 10:03 Spritekin

That would be great, I would love that.

Kulikowski avatar Mar 10 '16 14:03 Kulikowski

use mesos constraints to limited?

xiaods avatar Mar 22 '16 20:03 xiaods

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

Spritekin avatar Mar 23 '16 03:03 Spritekin

@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.

Rob-Johnson avatar Apr 09 '16 09:04 Rob-Johnson

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

Spritekin avatar Apr 13 '16 06:04 Spritekin

@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": "[email protected]", "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 !

batizty avatar Nov 18 '16 07:11 batizty

@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.

Rob-Johnson avatar Nov 18 '16 09:11 Rob-Johnson

@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.

batizty avatar Nov 18 '16 11:11 batizty

I want the same too

ydp avatar Sep 12 '17 02:09 ydp

I want the same too

junneyang avatar Aug 10 '18 10:08 junneyang