Skip to content

TIMER

The TIMER node sleeps for a specified number of seconds.Params:sleep_time : floatnumber of seconds to sleepReturns:
Python Code
from flojoy import flojoy, DataContainer, DefaultParams
from flojoy.utils import PlotlyJSONEncoder
from flojoy.job_result_builder import JobResultBuilder
import plotly.graph_objects as go
import time
import json
from typing import Optional, cast


@flojoy
def TIMER(
    default: Optional[DataContainer] = None,
    sleep_time: float = 0,
) -> DataContainer:
    """The TIMER node sleeps for a specified number of seconds.

    Parameters
    ----------
    sleep_time : float
        number of seconds to sleep
    """

    time.sleep(sleep_time)
    result = cast(
        DataContainer,
        JobResultBuilder().from_inputs([default] if default else []).build(),
    )

    return result

Find this Flojoy Block on GitHub

Example

Having problem with this example app? Join our Discord community and we will help you out!
React Flow mini map

In this example the TIMER node sleeps for number of seconds passed to its parameter sleep_time which is 5 in this case before executing other nodes CONSTANT and END.