Hi all - I’ve just noticed that some tasks set to ...
# ask-community
b
Hi all - I’ve just noticed that some tasks set to “manual_only” aren’t respecting the tag and just running. Can anyone suggest why this might be?
k
Hey @Ben Collier, this only happens sometimes? Could you show how you declare those tasks?
b
Copy code
@task(trigger=manual_only)
def validate_data(workflow_execution_id):
    <the code>
k
Looks good to me. What version are you on?
b
A very recent one!
(Not helpful, I know!)
0.14.22 I think
k
I’m wondering if you just added this and have an idempotency key that caused it to not register?
b
Can you explain that theory in more detail?
The flow has been up for a while. We have three of these manual tasks running in order, and they all trigger one after another with no manual input.
k
Let’s just say you didn’t have
manual_only
first, and you registered with
prefect register …
on the CLI. If you just added the
manual_only
, I can wondering if the
prefect register
will detect that change and register.
How are you registering?
b
Each task is called from a with block for the flow. The flow itself is run from a line of python in a different application:
Copy code
prefect_response = client.create_flow_run(...
k
I don’t how it’s called should affect it. How is the flow the has the
manual_only
registered?
b
So the task has manual only on it. The flow is just declared:
Copy code
with Flow("My Flow") as flow:
    ids = Parameter('ids')
    task1 = task1(prefect.context.get("flow_run_id"), labSampleIds)
    task2 = task2(prefect.context.get("flow_run_id"), upstream_tasks=[task1])

...
k
When you do
task1 = task1(prefect.context.get("flow_run_id"), labSampleIds)
, could you try a different name so they don’t hit like
task_1 = task1(...)
? Unsure if this will help.
You can use
flow.run
to test too like:
Copy code
from prefect import Flow, task
from prefect.triggers import manual_only

@task(trigger=manual_only)
def abc(x):
    return x

with Flow("test") as flow:
    abc(1)

flow.run()
To see if that trigger is working in this flow. I guess you cant test this way actually because you need context.
b
Not entirely sure why I ended up overwriting the function names.
I’ll make that change. If it works, that’d be great. Like you, I suspect that isn’t the issue.