https://prefect.io logo
Title
h

Hedgar

03/02/2022, 9:31 PM
I think I have a challenge with my flow as it's running twice instead of once(the scheduled time) If The last line of my flow code is
flow.register(projectname, flowname e.t.c
Would it be necessary to do again on the command line
prefect register...
before doing
prefect agent local start
?
k

Kevin Kho

03/02/2022, 9:33 PM
Do you still have
flow.run()
in there somewhere? I think running twice is different from registering twice? and no you shouldn’t need to register twice
h

Hedgar

03/02/2022, 9:40 PM
No I don't have
flow.run()
should I? I thought if I can start the local agent my flow would run when the schedule time hit?
k

Kevin Kho

03/02/2022, 9:41 PM
Yes you shouldn’t have it for a registered flow. I was just asking because you said it’s running twice. What does your schedule look like in the UI?
Do you think it’s the old version firing also?
h

Hedgar

03/02/2022, 9:49 PM
Runs every
07 18 * * *
but since I have a lambda that starts and shuts down my ec2 I wrote a bash script wherein I registered and starts the local agent at
03 18 *  * *
now instead of just running the schedule time it also runs @`03 18 * * *`
k

Kevin Kho

03/02/2022, 9:51 PM
I think your bash script doesn’t need to register right? If it runs at
03 18 * * *
, I am also wondering if there was a late run lingering because the agent will just pick up all late runs when it starts
h

Hedgar

03/02/2022, 9:58 PM
So I should just run
prefect agent local start
@
03 18 * * *
? I suspect registering again with cli is triggering a run and when the schedule time hit it equally run
k

Kevin Kho

03/02/2022, 9:59 PM
Yes exactly and if it’s already registered with a schedule, then the scheduled run will be picked up by the agent. No further re-registration needed
h

Hedgar

03/02/2022, 10:00 PM
excellent @Kevin Kho 👍