Anthony
11/13/2024, 9:30 PMprefect config set PREFECT_RESULTS_PERSIST_BY_DEFAULT=true
on independent flow runs triggered by
flow_run = await run_deployment("embed-pdf/default", parameters={"url": "test/sample.pdf"}, timeout=0)
i'm not seeing any cached resultsChris White
config set
command locally and then trigger the deployment? If it runs remotely then your local profile will have no bearing on its result persistence. To configure settings on remote deployments you have a few options:
• environment variables (maybe the easiest to set)
• setting files (.env
or prefect.toml
or pyproject.toml
): these have the benefit of being source controlled next to your code
For more information check out the settings documentation here: https://docs.prefect.io/3.0/develop/settings-and-profiles#configure-settings-and-profilesAnthony
11/13/2024, 10:14 PMprefect config set PREFECT_RESULTS_PERSIST_BY_DEFAULT=true
Set 'PREFECT_RESULTS_PERSIST_BY_DEFAULT' to 'true'.
Updated profile 'local'.
then worker.py
# worker.py
from core.workers.workflows.embed_pdf import embed_pdf
def deploy():
embed_pdf.serve(
name="default",
version="1.0.0",
)
then in a separate terminal i'm proceeding to trigger the worker via run_deployment(..)
I also run theAnthony
11/13/2024, 10:16 PM@task(_log_prints_=True, _persist_result_=True)
for each taskChris White
Anthony
11/13/2024, 10:26 PM@task(_log_prints_=True, _cache_policy_=TASK_SOURCE)
the caching does work. Thank you!Chris White
Anthony
11/13/2024, 10:33 PMworkflow
process, or do I also have to set it in the process where i run prefect server start
Chris White
PREFECT_SERVER_
👍Anthony
11/13/2024, 10:36 PMAnthony
11/13/2024, 10:37 PM@task(cache_policy=TASK_SOURCE + INPUTS)
Anthony
11/13/2024, 10:37 PMChris White
Chris White