Forum Discussion

Mahesh7225's avatar
Mahesh7225
New Contributor
5 years ago

Pause for 10 to 15 minutes to trigger

In snaplogic is there any feature available while any process going on from third party , can we wait 10 -20 sec to get response, is such feature/logic is available?

Thanks
Mahesh

3 Replies

  • Supratim's avatar
    Supratim
    Contributor III

    @Mahesh7225 There is no in built snap available. You can use below python script to wait. But in case of 10/15mins to wait should use scheduler to trigger.

    import time

    Import the interface required by the Script snap.

    from com.snaplogic.scripting.language import ScriptHook

    class TransformScript(ScriptHook):
    def init(self, input, output, error, log):
    self.input = input
    self.output = output
    self.error = error
    self.log = log

    # The "execute()" method is called once when the pipeline is started
    # and allowed to process its inputs or just send data to its outputs.
    def execute(self):
        while self.input.hasNext():
            data = self.input.next()
            time.sleep(10)
            self.output.write(data)
        self.log.info("Finished executing the Transform script")
    

    The Script Snap will look for a ScriptHook object in the “hook”

    variable. The snap will then call the hook’s “execute” method.

    hook = TransformScript(input, output, error, log)