https://prefect.io logo
h

Hui Zheng

12/04/2020, 8:44 PM
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
Copy code
<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
Copy code
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
Copy code
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.
z

Zanie

12/04/2020, 8:56 PM
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.
❤️ 2