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

12 views
Skip to first unread message

felipe...@gmail.com

unread,
Feb 8, 2019, 10:22:34 PM2/8/19
to Jenkins Developers
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 

Jesse Glick

unread,
Feb 11, 2019, 9:42:13 AM2/11/19
to Jenkins Dev
On Fri, Feb 8, 2019 at 10:22 PM <felipe...@gmail.com> wrote:
> I'd like to also control the Result of the Run

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

felipe...@gmail.com

unread,
Feb 11, 2019, 5:08:44 PM2/11/19
to Jenkins Developers
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..

Jesse Glick

unread,
Feb 11, 2019, 7:47:50 PM2/11/19
to Jenkins Dev
On Mon, Feb 11, 2019 at 5:08 PM <felipe...@gmail.com> 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`.
Reply all
Reply to author
Forward
0 new messages