Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the timeout of Langflow process #5302

Open
d0uub opened this issue Dec 17, 2024 · 1 comment
Open

Change the timeout of Langflow process #5302

d0uub opened this issue Dec 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@d0uub
Copy link

d0uub commented Dec 17, 2024

Bug Description

when i run the process over 30 seconds it will have error:
Network error. Please check the connection to the server.

where can i extend the timeout ?

Reproduction

import re
import asyncio
from playwright.async_api import async_playwright


from langflow.custom import Component
from langflow.io import DictInput, Output
from langflow.schema import Data
from langflow.schema.message import Message

class Playwright(Component):
    display_name = "Playwright"
    description = "Fetch and scrape content from one or more URLs using Playwright."
    icon = "layout-template"
    name = "Playwright"
    inputs = [
        DictInput(
            name="urls",
            is_list=True,
            display_name="URLs and selectors",
            info="Key for URL, value for selector",
        )
    ]

    outputs = [
        Output(display_name="Data", name="data", method="fetch_content_data"),
    ]



    async def fetch_content_data(self) -> list[Data]:
        import time
        time.sleep(31)
        return

Expected behavior

expect playwright able to execute more than 30 seconds

Who can help?

No response

Operating System

FROM langflowai/langflow:latest

Langflow Version

1.0.19

Python Version

3.12

Screenshot

No response

Flow File

No response

@d0uub d0uub added the bug Something isn't working label Dec 17, 2024
Copy link

dosubot bot commented Dec 17, 2024

To extend the timeout for the Langflow process and allow Playwright to execute for more than 30 seconds, you can adjust the timeout settings in both the Playwright configuration and the server-side process.

  1. Playwright Configuration: In the playwright.config.ts file, increase the timeout setting. It's currently set to 120 seconds (120,000 milliseconds), but you can increase it further if needed. For example, to set it to 5 minutes:

    timeout: 300 * 1000,
  2. Server-Side Process: The timeout for the server-side process is configured in the src/backend/langflow/__main__.py file. The default worker timeout is set to 300 seconds. You can adjust this by setting the LANGFLOW_WORKER_TIMEOUT environment variable to a higher value if necessary.

    timeout: int = typer.Option(300, help="Worker timeout in seconds."),

    You can set the LANGFLOW_WORKER_TIMEOUT environment variable in your terminal or import it from a .env file to change the default timeout.

These adjustments should help prevent the network error by allowing more time for the process to complete [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant