[Proposal] Hook for executors accepting a job

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Proposal] Hook for executors accepting a job

stephenconnolly
Kohsuke,

Is there a hook for when an executor accepts a job?

The closest I can see is BuildListener... but given that it extends TaskListener, there's more than I'd like on that interface.

What I really want to do is add jobAccepted and jobCompleted methods to Computer.

Then SlaveComputer can override these methods to notify the retention strategy and/or the computer launcher if they implement a JobListener interface.

I need this hook to allow for things like:
- Reverting a virtual machine to a snapshot after every job completes
- Allowing retention strategies and/or computer launchers to preventing a virtual machine from accepting other further jobs if certain conditions have arisen... e.g. revert to snapshot every n builds

Do you agree that this approach is good, or is there some listener that I'm missing from seeing that does this already?

-Stephen
Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Hook for executors accepting a job

Kohsuke Kawaguchi
Administrator
Stephen Connolly wrote:
> Kohsuke,
>
> Is there a hook for when an executor accepts a job?
>
> The closest I can see is BuildListener... but given that it extends
> TaskListener, there's more than I'd like on that interface.

Right. Moreover, this is not an extension point --- it's always
implemented by the core.

> What I really want to do is add jobAccepted and jobCompleted methods to
> Computer.

So you want the Computer class to be notified? But this isn't an
extension point either, right?

I think "taskStarted" "taskCompleted" would be a better name, given that
Executor executes a Queue.Task.

> Then SlaveComputer can override these methods to notify the retention
> strategy and/or the computer launcher if they implement a JobListener
> interface.

Oh, OK, so you don't need this to be a generic extension point for all
plugins.


> I need this hook to allow for things like:
> - Reverting a virtual machine to a snapshot after every job completes
> - Allowing retention strategies and/or computer launchers to preventing a
> virtual machine from accepting other further jobs if certain conditions have
> arisen... e.g. revert to snapshot every n builds

For you to do the 2nd bullet point, don't you need to more than a
listener? It sounds like you need it to be able to influence how
Executors get matched up with JobOffers.


> Do you agree that this approach is good, or is there some listener that I'm
> missing from seeing that does this already?

I think Computers getting notified of what its Executors are doing seem
reasonable.

We can also have perhaps ExecutorListener as a new extension point to
listen on everything going on in executors, if that's useful for someone.

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Proposal] Hook for executors accepting a job

stephenconnolly
OK,

I'll take a stab at implementing something

On Tue, Jun 17, 2008 at 12:33 AM, Kohsuke Kawaguchi <[hidden email]> wrote:
Stephen Connolly wrote:
Kohsuke,

Is there a hook for when an executor accepts a job?

The closest I can see is BuildListener... but given that it extends
TaskListener, there's more than I'd like on that interface.

Right. Moreover, this is not an extension point --- it's always implemented by the core.


What I really want to do is add jobAccepted and jobCompleted methods to
Computer.

So you want the Computer class to be notified? But this isn't an extension point either, right?

I think "taskStarted" "taskCompleted" would be a better name, given that Executor executes a Queue.Task.


Then SlaveComputer can override these methods to notify the retention
strategy and/or the computer launcher if they implement a JobListener
interface.

Oh, OK, so you don't need this to be a generic extension point for all plugins.



I need this hook to allow for things like:
- Reverting a virtual machine to a snapshot after every job completes
- Allowing retention strategies and/or computer launchers to preventing a
virtual machine from accepting other further jobs if certain conditions have
arisen... e.g. revert to snapshot every n builds

For you to do the 2nd bullet point, don't you need to more than a listener? It sounds like you need it to be able to influence how Executors get matched up with JobOffers.



Do you agree that this approach is good, or is there some listener that I'm
missing from seeing that does this already?

I think Computers getting notified of what its Executors are doing seem reasonable.

We can also have perhaps ExecutorListener as a new extension point to listen on everything going on in executors, if that's useful for someone.

Yep, I'll give it a shot
 


--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]