Forum Discussion

manjunathsinghs's avatar
manjunathsinghs
New Contributor II
22 days ago
Solved

Hi, Is there a way where we can add delay/wait of 3~5 seconds before every post call?

Hi, 
I have a requirement where i need to post (http client post call) a data by splitting it into multiple batches, like 100 records per batch.
so, is there a way where we can add delay/wait of 3~5 seconds before every post call?

  • Hi manjunathsinghs - I input your question in SnapGPT. For your reference you can access SnapGPT in the upper nav bar of the Designer here:

    Here is the response below. Keep in mind if you have the pipeline open and input your question in SnapGPT, it will provide an updated pipeline recommendation that you can import in a new tab.

    Yes, there are several ways to add a delay/wait of 3-5 seconds before every HTTP POST call in SnapLogic, especially when you need to split data into batches and process them with delays. Here are the recommended approaches:

    Method 1: Using Script Snap with time.sleep() (Recommended)

    Added Delay Script Snap

    New Snap Added:

    • Delay Script (Remote Python Script) - Introduces a 4-second delay before each HTTP POST call using Python's time.sleep() function

    Pipeline Flow Changes:

    • Disconnected: Mapper (snap_2) from HTTP Client (snap_3)
    • Connected: Mapper (snap_2) to Delay Script (snap_5)
    • Connected: Delay Script (snap_5) to HTTP Client (snap_3)

    Script Functionality:

    • Uses Python's time.sleep(4) to pause execution for 4 seconds (middle value of the requested 3-5 second range)
    • Passes input data through unchanged to maintain data integrity
    • Implements the required snaplogic_init(), snaplogic_process(), and snaplogic_final() functions for the Remote Python Script Snap

    The delay will now be applied before each POST request to the SageMaker endpoint, helping to prevent potential rate limiting or overwhelming the service.

    Pipeline:

     

1 Reply

  • Hi manjunathsinghs - I input your question in SnapGPT. For your reference you can access SnapGPT in the upper nav bar of the Designer here:

    Here is the response below. Keep in mind if you have the pipeline open and input your question in SnapGPT, it will provide an updated pipeline recommendation that you can import in a new tab.

    Yes, there are several ways to add a delay/wait of 3-5 seconds before every HTTP POST call in SnapLogic, especially when you need to split data into batches and process them with delays. Here are the recommended approaches:

    Method 1: Using Script Snap with time.sleep() (Recommended)

    Added Delay Script Snap

    New Snap Added:

    • Delay Script (Remote Python Script) - Introduces a 4-second delay before each HTTP POST call using Python's time.sleep() function

    Pipeline Flow Changes:

    • Disconnected: Mapper (snap_2) from HTTP Client (snap_3)
    • Connected: Mapper (snap_2) to Delay Script (snap_5)
    • Connected: Delay Script (snap_5) to HTTP Client (snap_3)

    Script Functionality:

    • Uses Python's time.sleep(4) to pause execution for 4 seconds (middle value of the requested 3-5 second range)
    • Passes input data through unchanged to maintain data integrity
    • Implements the required snaplogic_init(), snaplogic_process(), and snaplogic_final() functions for the Remote Python Script Snap

    The delay will now be applied before each POST request to the SageMaker endpoint, helping to prevent potential rate limiting or overwhelming the service.

    Pipeline: