h

    Hui Zheng

    1 year ago
    Hello, I ran into another issue with timeout setting. I would like to set a default timeout for all the tasks. I shall be able to do it through environment variable
    PREFECT__TASKS__DEFAULTS__TIMEOUT
    according to this doc
    <https://docs.prefect.io/core/concepts/configuration.html#environment-variables>
    However, when I do it properly, I got an error.
    TypeError: Only integer timeouts (representing seconds) are supported.
    even when I assigns the integer value. (See thread for details)
    I set the default variable in
    flow.storage = Docker(
            # set prefect.config
            "PREFECT__TASKS__DEFAULTS__MAX_RETRIES": 2,
            "PREFECT__TASKS__DEFAULTS__TIMEOUT": 30,
            "PREFECT__TASKS__DEFAULTS__RETRY_DELAY": 5,
            "PREFECT__TASKS__DEFAULTS__CHECKPOINT": True,
    
        }
    All other default variables works, but TIMEOUT failed. error log
    Traceback (most recent call last):
      File "flow.local-test.py", line 1, in <module>
        from flow import flow
      File "/app/flow.py", line 155, in <module>
        def fetch_runnable_models(current_stamp: datetime) -> list:  # noqa
      File "/usr/local/lib/python3.8/site-packages/prefect/utilities/tasks.py", line 399, in <lambda>
        return lambda fn: prefect.tasks.core.function.FunctionTask(
      File "/usr/local/lib/python3.8/site-packages/prefect/tasks/core/function.py", line 63, in __init__
        super().__init__(name=name, **kwargs)
      File "/usr/local/lib/python3.8/site-packages/prefect/core/task.py", line 279, in __init__
        raise TypeError(
    TypeError: Only integer timeouts (representing seconds) are supported.
    Michael Adkins

    Michael Adkins

    1 year ago
    Hi! This looks like a bug in our processing of this config value. I’ve opened a PR to fix it but I haven’t had a chance to test it / add additional tests covering this to our code. It’s available at https://github.com/PrefectHQ/prefect/pull/3761 if you’d like to give it a try in the meantime.