Prefect task pause to resume state to running state

I want to resume a task from Pause state to Resume state or Running state but its not working

import prefect
from prefect import task, Flow
from prefect.triggers import manual_only
from prefect.engine import signals

@task
def build():
    logger = prefect.context.get("logger")
    logger.info("build task")
    print("build task")
    return True

@task
def test(build_result):
    logger = prefect.context.get("logger")
    logger.info("test task")
    print("test task")

@task(trigger=manual_only)
def deploy():
    logger = prefect.context.get("logger")
    logger.info("deploy for pause resume task")
    """With the manual_only trigger this task will only run after it has been approved"""
    print("deploy task")
    pass
    
with Flow("code_deploy") as flow:
    build()
    test(True)
    deploy()


# flow.run has been commented out to register and run the flow with Prefect Cloud
# use flow.run to run and test the flow locally
# the manual only trigger will prompt to resume the task in the command line
#flow.run()

# Registers the flow with a project named pause_resume
flow_id = flow.register("tester")

# # flow.run_agent()
# print(flow_id)

But resume is not working,
Simple please let me know the best/simple way to resume a task, no where of docs mention how to resume a task.

1 Like

I believe what is missing is setting dependencies between tasks, can you try this?

with Flow("code_deploy") as flow:
    t1 = build()
    t2 = test(True, upstream_tasks=[t1])
    deploy(upstream_tasks=[t2])

Regarding docs, check those resources: