Tilak Maddy
12/03/2021, 10:26 AMUserWarning: No result handler was specified on your Flow. Cloud features such as input caching and resuming task runs from failure may not work properly. registered_flow = client.register(
That's the whole warning message. and here is the code. It worked properly though when i triggered the run from prefect cloud, there was no problem in execution. But I want to be able to resume tasks is they fail. what do I do ?
import os
import time
from prefect.storage import GitHub
import prefect
from prefect import task, Flow, Parameter
from prefect.run_configs import LocalRun
from prefect.executors import LocalDaskExecutor
@task
def say_hello(name):
# Add a sleep to simulate some long-running task
time.sleep(3)
# Load the greeting to use from an environment variable
greeting = os.environ.get("GREETING")
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(f"{greeting}, {name}!")
with Flow("hello-flow") as flow:
people = Parameter("people", default=["Arthur", "Ford", "Marvin"])
say_hello.map(people)
flow.storage = GitHub(
repo="XXX/test-repo",
path="learning_storage.py",
access_token_secret="XXX"
)
flow.run_config = LocalRun(env={"GREETING": "Hello from User 2 "}, labels=["dev"])
flow.executor = LocalDaskExecutor()
flow.register(project_name="test_user_2")
Ran this on my local machine. yes I have a copy of the flow in the mentioned github repo too.Anna Geller
from prefect import Flow, task
from prefect.engine.results import LocalResult
@task(result=LocalResult(dir='~/Desktop/HelloWorld/results'))
def my_task():
return 3
Anna Geller
prefect.engine.results
Tilak Maddy
12/03/2021, 10:43 AMAnna Geller
Tilak Maddy
12/03/2021, 10:44 AMAnna Geller