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/47FBC417-3C52-45AF-AF20-2115831B112C%40cloudbees.com.

Reply via email to