Ahhh Thanks a ton Devin. appreciate your help on this. Also i am trying to learn the sh implemenattion as you suggested and 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 On Thursday, 23 July 2020 22:18:05 UTC+5:30, Devin Nusbaum wrote: > > Yes, it is like Jesse said. The CPS VM thread automatically interrupts any > synchronous code/step that takes more than 5 minutes to execute. Once you > fix the step so it executes asynchronously (or redesign it so the actual > work is done by the `sh` step) then the CPS VM thread will stop > interrupting it and the timeout set by the `timeout` step will take effect. > > On Jul 23, 2020, at 12:42, Nikhil Bhoski <[email protected] > <javascript:>> wrote: > > Thanks Alot Davin for such detailed explanation. I will check sh and bat > and try understand its implementation . However i was curious to know if > this is the reason that possibly causing issue of not abiding timeout block > . > > Thanks & Regards > Nikhil > > On Thursday, 23 July 2020 21:59:52 UTC+5:30, Devin Nusbaum wrote: >> >> Although you tried to make your step asynchronous, it is not actually >> asynchronous. `execMatlabCommand` runs during your StepExecution’s `start` >> method and internally calls `Process.join` to wait for the process to >> complete, so your `start` method doesn’t return until the process >> completed. Another indication that your step is not asynchronous is that >> you call `getContext().onSuccess(true);` before you `return false` from the >> step, meaning that your step has already completed. >> >> You need to change things so that your step starts the command and then >> sets up a background process to check its status periodically to know if it >> is completed. Doing this for external processes is somewhat complex, but >> you could look at the `sh` and `bat` steps for an example. >> >> Stepping back a little bit, I would try to investigate to see if you >> could implement this plugin’s functionality in a different way (maybe a >> block-scoped step that sets up environment variables, etc. as needed) and >> just have users use the standard `sh` and `bat` steps to launch the Matlab >> command so that you do not have to reimplement that functionality. >> >> >> > On Jul 23, 2020, at 12:18, Nikhil Bhoski <[email protected]> wrote: >> > >> > Hi Gavin , >> > >> > The stop is implemented as per the doc which Jesse shared. it reads >> like below >> > But i get your point now and i guess i should kill the process in >> stop. any ideas on how could i get access to the process in stop () ? >> > >> > You should also implement stop to terminate the step. It could simply >> read >> > >> > getContext().onFailure(cause); >> > >> > On Thursday, 23 July 2020 21:22:12 UTC+5:30, Gavin Mogan wrote: >> > Its been a long time since i wrote plugins using these APIs but how >> come your on stop isn't doing anything? Shouldn't it kill the process? >> > >> > On Thu., Jul. 23, 2020, 8:48 a.m. Nikhil Bhoski, <[email protected]> >> wrote: >> > Thanks Jesse, >> > >> > I had referred the same doc and i guess i am following as per >> recommendation. Here is my step execution class >> > >> > >> https://github.com/jenkinsci/matlab-plugin/blob/master/src/main/java/com/mathworks/ci/MatlabCommandStepExecution.java >> >> > >> > Which will be called in >> > >> > >> https://github.com/jenkinsci/matlab-plugin/blob/master/src/main/java/com/mathworks/ci/RunMatlabCommandStep.java >> >> > >> > Thanks & Regards >> > Nikhil >> > >> > On Thursday, 23 July 2020 19:09:30 UTC+5:30, Jesse Glick wrote: >> > On Thu, Jul 23, 2020 at 3:47 AM Nikhil Bhoski <[email protected]> >> wrote: >> > > when i use this step with options block with 6 minutes pause as >> shown below.my step does not seem to have any effect of this overriden >> timeout value . It always gets terminated after 5 minutes >> > >> > You are most likely blocking the whole CPS VM thread, which is illegal. >> See: >> > >> > >> https://github.com/jenkinsci/workflow-step-api-plugin/blob/master/README.md#creating-an-asynchronous-step >> >> > >> > -- >> > 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/12357eb4-d90e-4494-8c6f-619c22a718a4o%40googlegroups.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/47dea698-df6c-485d-9df3-9230e305c480o%40googlegroups.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] <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/d948f10c-eb14-42f4-aba5-ee765a1daf19o%40googlegroups.com > > <https://groups.google.com/d/msgid/jenkinsci-dev/d948f10c-eb14-42f4-aba5-ee765a1daf19o%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- 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/0cb5ab8f-092a-4091-bbf5-27ac136eb279o%40googlegroups.com.
