<filename>examples/retry.py
"""An example to retry the jobs when error happends"""
import time
from pipen import Pipen, Proc

class RetryProc(Proc):
    """Retry the jobs when fail"""
    input = "starttime"
    input_data = [int(time.time())]
    error_strategy = "retry"
    # Make sure the job succeeds finally
    num_retries = 10
    script = """
        if [[ $(date +"%s") -gt {{in.starttime + 3}} ]]; then
            exit 0
        else
            exit 1
        fi
    """

if __name__ == "__main__":
    # Show debug information so we see the retrying message
    Pipen(loglevel="debug").set_starts(RetryProc).run()

<filename>examples/retry.py
"""An example to retry the jobs when error happends"""
import time
from pipen import Pipen, Proc

class RetryProc(Proc):
    """Retry the jobs when fail"""
    input = "starttime"
    input_data = [int(time.time())]
    error_strategy = "retry"
    # Make sure the job succeeds finally
    num_retries = 10
    script = """
        if [[ $(date +"%s") -gt {{in.starttime + 3}} ]]; then
            exit 0
        else
            exit 1
        fi
    """

if __name__ == "__main__":
    # Show debug information so we see the retrying message
    Pipen(loglevel="debug").set_starts(RetryProc).run()

An example to retry the jobs when error happends Retry the jobs when fail # Make sure the job succeeds finally if [[ $(date +"%s") -gt {{in.starttime + 3}} ]]; then             exit 0         else             exit 1         fi # Show debug information so we see the retrying message