Hi Jesse, *SynchronousNonBlockingStepExecution * works perfectly fine. however i am interested in learning and implementing it using block-scoped step . as suggested i went through ant plugin code but i could not find the reference of getContext().newBodyInvoker(). I am still no clear that how i could invoke my external process using BodyInvoker(). if you could point out to me a few examples of plugins that would be really great.
Regards Nikhil On Friday, 24 July 2020 at 01:30:01 UTC+5:30 Nikhil Bhoski wrote: > Thanks Alot, Jesse and Davin for all you time and helping me learn it > better. > > I cannot use *SimpleBuildWrapper *as it it has the restriction of > carrying Context env variable (JENKINS-29144). Which i had discussed with > Jesse in below thread > > https://groups.google.com/forum/?nomobile=true#!topic/jenkinsci-dev/yOOPaxN-1vk > > I am looking for Pipeline specific solution for this and > *SynchronousNonBlockingStepExecution > *looks promising but yes my execution may vary in time definitely would > take more than a fraction of second. I guess i am left with only choice of > trying *block-scoped `Step`* > > > On Friday, 24 July 2020 00:26:02 UTC+5:30, Devin Nusbaum wrote: > >> Nikhil, maybe to make it clearer, what we mean is that instead of using >> your step like this: >> >> ``` >> runMATLABCommand "disp('************TIMEOUT >> STARTED********');disp(datetime('now'));pause(6*60);disp('************TIMEOUT >> >> ENDED********');disp(datetime('now'))" >> ``` >> >> You would implement a SimpleBuildWrapper or a block-scoped step so that >> users would instead do something like this (no idea how the Matlab >> executable works or how it accepts arguments, my escaping is probably wrong >> as well): >> >> ``` >> withMatlab(…) { >> sh(‘matlab "disp('************TIMEOUT >> STARTED********');disp(datetime(\’now\'));pause(6*60);disp('************TIMEOUT >> >> ENDED********');disp(datetime(\‘now\’))"') >> } >> ``` >> >> Maybe with a small helper step to convert a matlab command into a shell >> command if escaping for both Matlab and the shell is tedious, or if there >> are a bunch of arguments that the step needs to add automatically: >> >> ``` >> withMatlab(…) { >> sh(createMatlabCommand("disp('************TIMEOUT >> STARTED********');disp(datetime('now'));pause(6*60);disp('************TIMEOUT >> >> ENDED********');disp(datetime('now'))") >> } >> ``` >> >> With these kinds of approaches you don’t have to actually implement the >> complex pieces of the `sh` step yourself. I mentioned the `sh` step to show >> you how complicated it is to implement something similar, but I should have >> been clearer that you should really reconsider your step’s design; trying >> to reimplement the `sh` step does not make sense. >> >> >> > On Jul 23, 2020, at 14:34, Jesse Glick <[email protected]> wrote: >> > >> > On Thu, Jul 23, 2020 at 1:02 PM Nikhil Bhoski <[email protected]> >> wrote: >> >> i am looking into these classes here i hope i am at rite location. >> >> >> >> >> https://github.com/jenkinsci/workflow-durable-task-step-plugin/blob/e7c2d46eee43966560a3b9274aab3745a8e8f841/src/main/java/org/jenkinsci/plugins/workflow/steps/durable_task/DurableTaskStep.java#L99 >> >> > >> > You do not need to look at `DurableTaskStep` implementation at all. >> > Just implement `SimpleBuildWrapper`, which is quite straightforward. >> > Or if you need Pipeline specifics, a block-scoped `Step`; there are >> > plenty of examples, such as in the `ant` plugin (whose tests also >> > demonstrate usage). >> > >> > You _can_ implement `SynchronousNonBlockingStepExecution` but then >> > your step will not survive a Jenkins restart, so this should not be >> > done if you expect it to take more than a fraction of a second, which >> > I understand is not at all the case for you. >> > >> > -- >> > 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 [email protected]. >> > > To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr001XJJ4GS-MOQ2tEw8ef7wvtP2XMYh94gey_EhqK5kug%40mail.gmail.com. >> >> >> >> -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1316f58c-d3ca-44b3-a5d8-ef2c63c11c92n%40googlegroups.com.
