Controlling the run's Result from within a QueueTaskDispatcher using Future

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

Controlling the run's Result from within a QueueTaskDispatcher using Future

felipesfaraco
Hi,

I am currently extending QueueTaskDispatcher and customizing the canRun method, and it works fine.

I'd like to also control the Result of the Run originated from my Queue.Item that was under evaluation. Currently I am only able to achieve that with a custom Builder step.

When researching, it sounded like I could achieve this without the Builder step, by grabbing a Future using item.getFuture(). 

But all my attempts to customize the behavior of the Executable's run() method returned when the Future resolves has failed. 

I've created a CustomBuild class that extends from Build, overwrote the run() method, and also overwrote the BuildExecution's doRun() to achieve what I need.

But then I am not able to instantiate it using : QueueTaskFuture<CustomBuild> future = item.getFuture().

Eclipse only let's me do QueueTaskFuture<Executable> future = item.getFuture(), so not sure how can I tell that executable to evaluate to my CustomBuild.

Thanks 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/8ee5e7e9-8e0c-4711-a33c-de4b590394b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Controlling the run's Result from within a QueueTaskDispatcher using Future

Jesse Glick-4
On Fri, Feb 8, 2019 at 10:22 PM <[hidden email]> wrote:
> I'd like to also control the Result of the Run

Possible, though unusual, via `Run.setResult`.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3Xb0__reqqR8%2Bbqq%2BmKudU2vUbpnXKy7rcTKAOi-4n3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Controlling the run's Result from within a QueueTaskDispatcher using Future

felipesfaraco
Thanks, but the real question would be how to access the future "Run" from within the QueueTaskDispatcher's canRun() method ?

Per my understanding, by the time canRun executes, there's not a Run available yet, which why I thought the solution would involve using the getFuture() method..


On Monday, February 11, 2019 at 6:42:13 AM UTC-8, Jesse Glick wrote:
On Fri, Feb 8, 2019 at 10:22 PM <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="0qYxoJ-4AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">felipe...@...> wrote:
> I'd like to also control the Result of the Run

Possible, though unusual, via `Run.setResult`.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/b9b954bd-c222-4a50-bbd1-06e6a1c55874%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Controlling the run's Result from within a QueueTaskDispatcher using Future

Jesse Glick-4
On Mon, Feb 11, 2019 at 5:08 PM <[hidden email]> wrote:
> Per my understanding, by the time canRun executes, there's not a Run available yet

Well if the `QueueTaskFuture` finishes, or just starts, you can check
whether the `Queue.Executable` is in fact a `Run`.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2dxOj6WtU8nWcWVGsWvxe-GFHNSwTUC5EDm4i9A3Pm9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.