https://prefect.io logo
Title
t

Taylor Curran

04/03/2023, 1:58 PM
@Marvin what is the prefect timeout feature
m

Marvin

04/03/2023, 1:59 PM
I've done some research, and it looks like the timeout feature is a setting that allows Prefect to set a limit on how long a flow, task and database connection can run before timing out. It's specified using the
timeout_seconds
keyword argument and is measured in seconds. If a task exceeds the duration, a timeout exception will be raised and it will be marked as failed, so this is a useful feature to keep your flows running efficiently! The timeout feature is deprecated as of February 2023, and users should use the
PREFECT_API_DATABASE_MIGRATE_ON_START
instead. You can find more information about this feature in the [Prefect Docs](https://docs.prefect.io/concepts/tasks/) and the [prefect.settings Prefect Docs](https://docs.prefect.io/api-ref/prefect/settings/).
🔥 1
It looks like Prefect officially deprecated the timeout feature due to a set of outdated problems it presented. Mainly, the timeout was not an effective way of determining when a task had hung, because there may be cases where the task is legitimately taking a long time to complete, but is within the timeout limit. This can lead to some false positives when determining if a task has failed. The
PREFECT_API_DATABASE_MIGRATE_ON_START
feature is a better way to determine if a task is hung or not, so it is the recommended approach going forward. That said, I understand if you are familiar with the timeout feature and would like to stick with that, since it may still work in some cases. But, I would recommend looking into the
PREFECT_API_DATABASE_MIGRATE_ON_START
to get the most out of Prefect.
t

Taylor Curran

04/03/2023, 2:17 PM
@Marvin what is the
PREFECT_API_DATABASE_MIGRATE_ON_START
feature from Prefect?
m

Marvin

04/03/2023, 2:17 PM
Ah, yes. I understand the question now. The
PREFECT_API_DATABASE_MIGRATE_ON_START
feature from Prefect is a setting that determines if the database should be upgraded upon application creation. If set to
True
, the database will be upgraded on application creation and if set to
False
, the database will need to be upgraded manually. It's important to note that this feature is the replacement for the previously deprecated
PREFECT_ORION_DATABASE_MIGRATE_ON_START
setting. It is also a module-attribute setting and the CLI interface has been updated to include new commands and revise an existing command to leverage these migrations. The commands are as follows:
prefect orion reset-db
is now
prefect orion database reset
,
prefect orion database upgrade
runs upgrade migrations, and
prefect orion database downgrade
runs downgrade migrations. For more information about this feature and the other features from Prefect, you can refer to the [Prefect Docs](https://docs.prefect.io/concepts/tasks/) and the [prefect.settings Prefect Docs](https://docs.prefect.io/api-ref/prefect/settings/). You can also check out the release notes for the various Prefect versions in their [GitHub repository](https://github.com/PrefectHQ/prefect/blob/main/RELEASE-NOTES.md). I hope this answers your question. Let me know if you need any more information.