Donnchadh McAuliffe
02/18/2022, 4:08 PMPOST: <http://localhost:4200/api/flow_runs/>
PAYLOAD:
{
"name": "my_scheduled_flow",
"deployment_id": "0ff88fc8-a71c-4b71-b8dd-078d6a36fb39",
"flow_id": "94374bea-70ae-4e49-8988-e9077daa280a",
"flow_version": "1.0",
"state": {
"type": "SCHEDULED",
"name": "my_scheduled_flow",
"message": "a message",
"state_details": {
"scheduled_time": "2022-02-18T16:10:49.005Z"
}
}
}
The flow run then appears in the server UI (as yellow) but never gets ran at the correct time. Does anyone have any idea on this? Am I missing an important part of the payload.Kevin Kho
Donnchadh McAuliffe
02/18/2022, 4:24 PMKevin Kho
Donnchadh McAuliffe
02/18/2022, 5:13 PM2022-02-18T17:11:43.254Z
and then every 20 mins until the next day (2022-02-18T18:11:43.254Z
)
Thank you!Kevin Kho
Donnchadh McAuliffe
02/21/2022, 11:56 AMPOST: <http://localhost:4200/api/flow_runs/>
PAYLOAD:
{
"name": "my_scheduled_flow",
"deployment_id": "0ff88fc8-a71c-4b71-b8dd-078d6a36fb39",
"flow_id": "94374bea-70ae-4e49-8988-e9077daa280a",
"flow_version": "1.0",
"state": {
"type": "SCHEDULED",
"name": "my_scheduled_flow",
"message": "a message",
"state_details": {
"scheduled_time": "2022-02-18T16:10:49.005Z"
}
}
}
Anna Geller
from prefect import flow
@flow
def hello_world(name="world"):
print(f"Hello {name}!")
from prefect.deployments import DeploymentSpec
from prefect.orion.schemas.schedules import IntervalSchedule
from datetime import timedelta
DeploymentSpec(
flow=hello_world,
name="hello-world-daily",
schedule=IntervalSchedule(interval=timedelta(days=1)),
tags=["earth"],
)
DeploymentSpec(
flow=hello_world,
name="hello-orion",
schedule=IntervalSchedule(interval=timedelta(weeks=1)),
parameters={"name": "Orion"},
tags=["marvin"],
)
Donnchadh McAuliffe
02/21/2022, 12:08 PM"state_details": {
"scheduled_time": "2022-02-18T16:10:49.005Z"
}
Anna Geller
DeploymentSpec
- the flow runs then get created via schedule
• or trigger the flow run ad hoc via an API call as you did
I think creating deployments and attaching schedules via an API call is not yet tested/documented so I would wait with that a bit.Donnchadh McAuliffe
02/21/2022, 12:23 PMAnna Geller
Donnchadh McAuliffe
02/21/2022, 5:04 PMPOST: <http://localhost:4200/api/deployments/{deployment_id}/schedule>
PAYLOAD: {
"start_time": "2022-02-21T17:00:00.000Z",
"end_time": "2022-02-21T17:02:00.000Z",
"max_runs": 4
}
it just returns null, 200
and subsequently doesn't run at the specified times.
I'm looking through the orion docs for schedules here, how do I specify the start and end time for the interval schedule of a deployment?
from prefect.deployments import DeploymentSpec
from prefect.orion.schemas.schedules import IntervalSchedule
from datetime import timedelta
DeploymentSpec(
flow_location="/Developer/workflows/my_flow.py",
name="my-first-deployment",
parameters={"nums": [1, 2, 3, 4]},
schedule=IntervalSchedule(interval=timedelta(minutes=15)),
)
Anna Geller
DeploymentSpec
has been stable for many weeks now and I would encourage you to set schedule only via DeploymentSpec for now.Donnchadh McAuliffe
02/21/2022, 8:43 PMfrom prefect.deployments import DeploymentSpec
from prefect.orion.schemas.schedules import IntervalSchedule
from datetime import timedelta
DeploymentSpec(
flow_location="/Developer/workflows/my_flow.py",
name="my-first-deployment",
parameters={"nums": [1, 2, 3, 4]},
schedule=IntervalSchedule(interval=timedelta(minutes=15)),
)
Anna Geller
Donnchadh McAuliffe
02/21/2022, 8:55 PMZanie
Donnchadh McAuliffe
02/22/2022, 9:25 AMAnna Geller
Donnchadh McAuliffe
02/22/2022, 12:54 PMAnna Geller
Donnchadh McAuliffe
02/24/2022, 11:51 AMend_time
and start_time
has been added to Orion?
from prefect.deployments import DeploymentSpec
from prefect.orion.schemas.schedules import IntervalSchedule
from datetime import timedelta
DeploymentSpec(
flow_location="/Developer/workflows/my_flow.py",
name="my-first-deployment",
parameters={"nums": [1, 2, 3, 4]},
schedule=IntervalSchedule(interval=timedelta(minutes=15)),
)
Anna Geller
Donnchadh McAuliffe
03/30/2022, 4:44 PM