Didier Marin
01/12/2022, 5:32 PMKevin Kho
Didier Marin
01/12/2022, 6:38 PMDidier Marin
01/13/2022, 2:43 PMfrom prefect import Client
from prefect.engine.results import PrefectResult
from flows.serializers import Base64PickleSerializer
# The following info can be found by navigating to the task run in the UI
task_run_id = ... # Your task run's id, e.g. "1cb9f9d4-9cdc-4606-b6d4-7a62cb82c4d5"
location = ... # Location of the task run's result, e.g. "gASVCQAAAAAAAABdlIwCZXWUYS4="
new_value = ... # New value to set up
c = Client()
# Get the original state
s = c.get_task_run_state()
# Override the state's result
r = PrefectResult(location=location, serializer=Base64PickleSerializer())
r = r.write(new_value)
s.result = r
# Update the state of the task_run
new_s = c.set_task_run_state(task_run_id, s)