Python Code block timeout

Hi, I've seen mention of the ability to set the timeout for a python code block. I can't seem to find where to do this?

Regardless, is it possible to set a timeout greater than 120 secs?

Thanks

Hi @magoo,

You can set the timeout option in the settings tab (click at the bottom of the block):

You should be able to set a timeout of up to 10min for a block.

Thanks Andrei.

I have that set to 300000 ms (5 mins) but I frequently get timeout error messages like so:
Error evaluating startRun: The code breached the timeout of 120 seconds

Is there a higher level flow timeout setting that could be overriding the code block timeout?

I just increased the timeout to 400000 ms and I get the same timeout error msg:

Error evaluating startRun: The code breached the timeout of 120 seconds

That is not expected.
Is this happening on cloud or a self-hosted deployment and if it is self-hosted, what version? Would you mind sharing a screenshot of the python block, or any information about what it does? Also are you seeing this timeout when running the entire workflow or when running a single block?

This is happening on cloud. I'm sharing a screenshot of the workflow dashboard and a failed run with the time out error. The python block is just submitting calls to openai and polling for a response. I am seeing this timeout when running the entire workflow.

Thank you for sharing the screenshot. I see this workflow is run as synchronous webhook. For synchronous webhooks, there is indeed a hard limit of 120 seconds per block, as they are intended for shorter workflows. We are looking into adjusting these limits, but this is currently the expected behavior.

As a workaround, would it be possible to make this workflow asynchronous? For example, you could remove the webhook return, write the result to a database and poll to fetch it.

Let me know if something like this could work for your use case.

ok thanks Andrei. I can restructure to async. Is there any documentation on async vs sync workflows?

Hi @magoo,

I see our documentation doesn't make the behavior of the response block very clear, and I will make sure to update it!

A workflow is run synchronously when it is triggered from a webhook, an app, or another workflow, and it has a response block:

If you remove this response block, triggering the workflow will enqueue a run and return immediately without waiting for completion. In that case, the time limit per block will be the one entered in the settings panel (up to 10min)