0

I launch tasks via Marathon. However they finish, Marathon restarts them. I would like them to only restart if they finish in failure. Is there a way such that if the task enters the state of TaskStatus.TASK_FINISHED that Marathon will not restart it, e.g., by suspending the job, i.e., by setting the number of tasks to zero?

Currently when my task completes successfully I PUT a message to the Marathon REST API scaling the job down to 0 instances. This is fine except that in response Marathon kills the task setting its status to TASK_KILLED and I would like it to be TASK_FINISHED to indicate its success.

mab
  • 760
  • 4
  • 18

1 Answers1

1

If you have one-of tasks as you describe, I think the better solution would be to use a scheduler like

Marathon is normally used to keep tasks running, and rescheduling them if they reach a final task state.

See the Marathon docs, and also this explanation of different task types.

Tobi
  • 31,405
  • 8
  • 58
  • 90
  • I think it's wort to mention [Singularity](https://github.com/HubSpot/Singularity) – janisz Sep 25 '16 at 15:47
  • @janisz IMO Singularity is a much broader solution, but thanks for mentioning! – Tobi Sep 25 '16 at 21:01
  • I guess I don't see this as a one-of task because I do want restarts in the case of failures. Perhaps one of the solutions you mention or Singularity does that? I'll take a look. Still, it does seem odd to me that a Marathon launched task can only end in a failed, aborted or killed state and never finished (which I assume is the success state). If you can definitively state that that is the case and add it to your answer then I will accept it. – mab Sep 26 '16 at 17:46
  • It is a one-of task in the sense that you want it finished at a certain point in time and NOT having it restarted. That's not what Marathon is used for normally... I added a reference to the Marathon docs in the answer. – Tobi Sep 26 '16 at 17:54