Forum Discussion

jibin_s's avatar
jibin_s
New Contributor II
2 years ago

Prevent further execution if an error occurred in a snap

Dear Community - 

Thanks for your help/support!

In this pipeline, how do I prevent In-Memory Lookup to execute when the REST Get snap fails? I see the sequence of execution is also incorrect. The snap In-Memory Lookup runs even before the REST Get snap runs. Please advise!

 

 

7 Replies

  • alchemiz's avatar
    alchemiz
    Contributor III

    Hi jibin_s ,

    Good day, had a similar scenario before...as a resolution I decoupled the pipeline then in the child pipeline set the all snaps "when error occurs" to "Stop Pipeline Execution" in this way any error that will occur in that child pipeline all on-going process will be aborted thus failing the pipeline then error will bubble-up to the parent pipeline from the pipeline execute ( if possible the child pipeline is reusable ) you can then trap/log the error

    The refactored pipeline will be looking something like this ... 
    Parent/Main pipeline

    Child Pipeline (2)

    EmEm

  • jibin_s - The reason that the In-Memory Lookup is being called is because you have "handled" the error from the Pipeline Execute by opening the error view on that snap, so the output view successfully closes and the In-Memory Lookup snap gets no data in the 121 bottom path (empty result) and still has the data from the 117 path, which is a perfectly valid state.  Because SnapLogic is a streaming platform, I believe the In-Memory Lookup and all subsequent snaps in that path are simply finishing before the Exit snap has a chance to fail out the pipeline.

    • jibin_s's avatar
      jibin_s
      New Contributor II

      Thanks, koryknick!

      That makes sense. But for achieving my logic, I had so restructure my pipeline. For further reference, I have mentioned the changes in my latest reply to alchemiz

  • jibin_s's avatar
    jibin_s
    New Contributor II

    Thanks, alchemiz!

    I tried the solution but unfortunately it did not help me. Following is the screenshot of the execution. In it you could see that the Pipeline Execute is failed but still the In Memory Lookup executed successfully. 

     

    • alchemiz's avatar
      alchemiz
      Contributor III

      Hi jibin_s .. you should also include the in-memory lookup in the child pipeline if you want it this way try setting up the output from the REST as the left hand side then the streaming copied document as the right side this way if there's no matching output from REST it will not stream

       

      • jibin_s's avatar
        jibin_s
        New Contributor II

        Thanks, alchemiz!

        1. If I use the In-Memory Lookup in the child pipeline, I'm unsure to pass the content from Copy snap (i.e: Workday documents in this case) to the lookup.
        2. Yes, it will work if I swap the inputs in In-Memory Lookup. But if I change the inputs, I'll not be able to achieve the logic of comparing the data to be processed further.

        I have managed to restructure my pipeline by adding following components:

        • Pipeline Execute - Executes REST Get snap to retrieve documents from API
        • Gate - Combines the inputs
        • Router - Check if there there are any errors from REST Get input? If so, execute Exit else proceed further
        • Mapper - Split the inputs and supplies them to In-Memory Lookup

         

  • jibin_s - If you move the highlighted snaps into a child pipeline and check the success of the return, it will prevent the downstream from executing.