juana
10/09/2024, 1:06 AMMarvin
10/09/2024, 1:07 AMpython
from prefect import flow, task
@task
def say_hello():
print("Hello, world!")
@flow
def hello_flow():
say_hello()
if __name__ == "__main__":
hello_flow()
This script will run entirely locally without a connection to a server. The tasks and flows will execute sequentially as part of the Python process.
3. Avoid Server Features: Ensure that your flows are not using any features that require server interaction, such as remote storage, API task triggers, or external state storage.
4. Environment: When running scripts, ensure your execution environment has Prefect installed, and avoid commands like prefect cloud login
which will try to establish a connection to Prefect Cloud.
This local execution is perfect for small scripts, testing, or use cases where Prefect's orchestration isn't necessary. If you plan to use these capabilities without connecting to any server, make sure to rely on the Prefect Python API standalone features.
For more information, you might want to explore available documentation and discussions, such as the Prefect forums or GitHub, though specific references in the official Prefect 3.x documentation for purely “server-free” execution are scarce.
(You can visit the Prefect 3.x documentation here)