Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to launch one-off tasks #344

Closed
guenter opened this issue Jun 21, 2014 · 41 comments
Closed

Add ability to launch one-off tasks #344

guenter opened this issue Jun 21, 2014 · 41 comments

Comments

@guenter
Copy link
Member

guenter commented Jun 21, 2014

Many apps require the ability to launch a one-off task (for example for database migrations). Add an easy way to do this in Marathon.

@guenter
Copy link
Member Author

guenter commented Jul 17, 2014

This branch has a POC: https://github.com/mesosphere/marathon/tree/one-off
It needs cleanup.

@chendo
Copy link

chendo commented Oct 14, 2014

+1

@chendo
Copy link

chendo commented Oct 14, 2014

We've hacked up a super dirty nsinit solution that lets us shell into a Docker container, however we're worried about the extra memory usage that might trigger the container into being killed

@karloscodes
Copy link

+1

1 similar comment
@mo-mughrabi
Copy link

👍

@andytinycat
Copy link

+1; any progress on this?

@ConnorDoyle ConnorDoyle added this to the 0.7.6 milestone Nov 17, 2014
@defender
Copy link

+1

1 similar comment
@gregory90
Copy link
Contributor

+1

@ConnorDoyle ConnorDoyle modified the milestones: 0.8.0, 0.9.0 Jan 20, 2015
@doctapp
Copy link

doctapp commented Mar 16, 2015

+1

1 similar comment
@j1n6
Copy link
Contributor

j1n6 commented Mar 17, 2015

+1

@doctapp
Copy link

doctapp commented Mar 26, 2015

For now, the only way we found to run one-off tasks is to use the suicide method:
{
"id": "myapp",
"cmd": "somecommand && curl -X DELETE marathon:8080/v2/apps/myapp"
...
}

@karloscodes
Copy link

+1

On Thu, Mar 26, 2015 at 4:15 PM Martin Tapp notifications@github.com
wrote:

For now, the only way we found to run one-off tasks is to use the suicide
method:
{
"id": "myapp",
"cmd": "somecommand && curl -X DELETE marathon:8080/v2/apps/myapp"
...
}

Reply to this email directly or view it on GitHub
#344 (comment).

@xjewer
Copy link

xjewer commented Apr 24, 2015

+1

@kolloch kolloch modified the milestones: 0.9.0, 0.10.0 May 18, 2015
@aquamatthias aquamatthias modified the milestones: 0.10.0, Backlog May 29, 2015
@mikljohansson
Copy link
Contributor

+1

@doctapp
Copy link

doctapp commented Nov 12, 2015

Any progress on this?

@Lawouach
Copy link

Indeed, is it something the team may look into in the future?

@meichstedt
Copy link
Contributor

Hey @Lawouach @doctapp and previous commenters,
Yes, we're aware that this makes sense in the context. There is an ongoing internal discussion on integrating one off job support into Marathon, but we do not yet have a clear direction.

Feel free to share use cases: migrations, setting up prerequisites, general cron jobs – which features would you need in order to have decent benefit?

@doctapp
Copy link

doctapp commented Dec 1, 2015

One use case is running an ad hoc job such as running a batch job (e.g.
ETL) or training a machine learning model.

The principal benefit is that we can perform these tasks whenever they are
required (daily basis) without extensive planning.

We are using the 'suicide hack' that I posted for these jobs. We are using
marathon since it's API is better suited to our needs than a framework like
Chronos.

On Mon, Nov 30, 2015 at 9:19 PM, Matthias Eichstedt <
notifications@github.com> wrote:

Hey @Lawouach https://github.com/Lawouach @doctapp
https://github.com/doctapp and previous commenters,
Yes, we're aware that this makes sense in the context. There is an ongoing
internal discussion on integrating one off job support into Marathon, but
we do not yet have a clear direction.

Feel free to share use cases: migrations, setting up prerequisites,
general cron jobs – which features would you need in order to have decent
benefit?


Reply to this email directly or view it on GitHub
#344 (comment)
.

@Lawouach
Copy link

Lawouach commented Dec 1, 2015

Another use-case, though it's more likely a workaround at this stage, is to run a task to post-configure a task. Unless I have missed something, Marathon doesn't offer me a way to run post-configuration scripts from the host where those tasks are running so I resort to one-shot tasks.

I grant you this is more a workaround than a real use-case mind you.

@kolloch
Copy link
Contributor

kolloch commented Dec 1, 2015

What do you all think about having a separate service for one-off jobs with some Marathon integration, e.g. for life cycle hooks?

Or another way of asking: What would be missing compared to a solution where it all is integrated into Marathon? What does "integration" mean for you?

@doctapp
Copy link

doctapp commented Dec 7, 2015

The idea of running a Marathon job to handle one-off jobs beats the purpose of a scheduler handling such a task. Plus, we don't need another task taking cluster resources for that purpose; that's the framework's job.

We need a flag or some way of telling Marathon not to restart a job if it finishes.

@kolloch
Copy link
Contributor

kolloch commented Dec 14, 2015

@doctapp I should have made it more clear: My idea was creating a separate service (= framework) that is able to run any number of one-off tasks. So you would need to talk to a different end-point to achieve this.

In Marathon itself we could include hooks for life-cycle events that would end-up creating one-off tasks using the separate service.

Would that satisfy your requirements? If not, what exactly is missing.

@doctapp
Copy link

doctapp commented Dec 14, 2015

The problem with another framework is that we would need to support two
types of APIs. From my perspective, we need Marathon's api with one-off
task launching and handling. That's why we're not using Chronos or others.

Why can't you simply extend Marathon for this purpose? The suicide hack is
the better alternative to another framework in my opinion...

On Mon, Dec 14, 2015 at 7:47 AM, Peter Kolloch notifications@github.com
wrote:

@doctapp https://github.com/doctapp I should have made it more clear:
My idea was creating a separate service (= framework) that is able to run
any number of one-off tasks. So you would need to talk to a different
end-point to achieve this.

In Marathon itself we could include hooks for life-cycle events that would
end-up creating one-off tasks using the separate service.

Would that satisfy your requirements? If not, what exactly is missing.


Reply to this email directly or view it on GitHub
#344 (comment)
.

@kolloch
Copy link
Contributor

kolloch commented Dec 14, 2015

@doctapp "Why can't you simply extend Marathon for this purpose?" We probably could extend it. I question the "simply". I'd rather focus on making single components of software as simple as possible.

In my opinion, the API for one-off-jobs SHOULD be different. For one-off-jobs, it is common to wait for them to complete (which does not make sense for long-running services). There is more...

Also the scheduler could be optimized for this different use case. For long-running tasks, you expect to have relatively few task starts/terminations. For one-off-scheduling that is the norm.

That said it should also use the same abstractions where possible (e.g. how to specify the command to run, resource constraints, ...).

@doctapp
Copy link

doctapp commented Dec 14, 2015

Agree and totally understand this. I don't mind having a distinct marathon
API for this purpose, as long as it's aligned between both type of tasks.
One-off tasks only need a subset of what long-running tasks expect.

That's why having one common API and endpoint (being a single Marathon
endpoint from the client's perspective), but with different
frameworks/implementation would be very interesting from my perspective...
We just don't want to deal with different framework APIs to launch tasks
that share common parameters mainly ports, resources...

On Mon, Dec 14, 2015 at 9:32 AM, Peter Kolloch notifications@github.com
wrote:

@doctapp https://github.com/doctapp "Why can't you simply extend
Marathon for this purpose?" We probably could extend it. I question the
"simply". I'd rather focus on making single components of software as
simple as possible.

In my opinion, the API for one-off-jobs SHOULD be different. For
one-off-jobs, it is common to wait for them to complete (which does not
make sense for long-running services). There is more...

Also the scheduler could be optimized for this different use case. For
long-running tasks, you expect to have relatively few task
starts/terminations. For one-off-scheduling that is the norm.

That said it should also use the same abstractions where possible (e.g.
how to specify the command to run, resource constraints, ...).


Reply to this email directly or view it on GitHub
#344 (comment)
.

@assumednormal
Copy link

Has there been any recent progress on this?

@air
Copy link
Contributor

air commented Apr 14, 2016

Good news everyone - this is now actively in design phase.

@ghost
Copy link

ghost commented Apr 15, 2016

@air This is a much needed feature. Is there any high level estimate when can this be ready in the main branch?

@ghost
Copy link

ghost commented Apr 15, 2016

Is there a work around to have one-off docker containers using Marathon?

@doctapp Provided a nice workaround with suicide method for the commands. Is there anyway to achieve this for docker containers?

@chendo Can you please provide more ideas for the hack you tried?

@ryanolson
Copy link

+1

@junneyang
Copy link

+1
database migration
batch configuration(pre,post,etc) for multi apps

@strzelecki-maciek
Copy link

+1 much needed feature imho.
Run arbitrary command in the same "context" as the defined app (same env, same docker image etc),
a.) allow to specify if the N instances of the deployed task can be spawned in parallel with this command or shortly after it finishes.
b.) Configured timeout on the command would be a nice addition too.

Use cases - cache warming, pre-start cleanup of some distributed services, database schema migrations and much more.

@nathanjackson
Copy link

+1

@kartikjoshi07
Copy link

@doctapp Provided a nice workaround with suicide method for the commands. Is there anyway to achieve this for docker containers?

@meichstedt
Copy link
Contributor

All, we have built Metronome on top of the Marathon core to provide this functionality. Please direct any requests to that project.

@yuandy
Copy link

yuandy commented Aug 26, 2016

Has there been any recent progress on this?

@grogsaxle
Copy link

+1

2 similar comments
@rmrfself
Copy link

+1

@ozayduman
Copy link

+1

@meichstedt
Copy link
Contributor

By popular request, we're happy to actually work on this. #5009 will provide more details soon.

Yes! It's true! It's happening!

@doctapp
Copy link

doctapp commented Jan 25, 2017

Excellent, finally no more suicide hack!

@mesosphere mesosphere locked and limited conversation to collaborators Mar 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests