karteekaddanki
07/20/2020, 2:42 PMfrom prefect.client import Client
import pandas as pd
if __name__ == "__main__":
dates = pd.bdate_range(pd.Timestamp("20200601"), pd.Timestamp("20200630"))
c = Client()
for d in reversed(dates):
c.create_flow_run(
"e04181f3-86b3-4f6f-87cf-ed7c24cb95ec",
parameters=dict(date=d.strftime("%Y-%m-%d")),
context=dict(name="John Doe"),
run_name=f"test_backfill_{d.strftime('%Y%m%d')}")
But some of the flow runs are stuck with
Queued due to concurrency limits. The local process will attempt to run the flow for the next 10 minutes, after which time it will be made available to other agents.I am on the dev version of the cloud backend and understand that there are limits. I have the following questions: 1. Am I hitting this error because of the dev cloud version? 2. Although, the message says the flow will be rescheduled within the next 10 minutes, it takes around 30 mins for the rest of the tasks to get scheduled and run. 3. Is there a better way to create a backfill? I am avoiding
FlowRunTask
because context is currently not passed to the triggered flow runsSven Teresniak
07/20/2020, 2:45 PMFlowRunTask
is internally using Client()
. Unfortunately the FlowRunTask
is broken in v0.12.4 when using server-mode (non-cloud).
In general using the FlowRunTask
is the preferred way to trigger (registered) flow runs.
Please ignore this advice when you're using the cloud-mode flavor of Prefect.Alex Cano
07/20/2020, 2:55 PMRunning
state, which means that tasks can run. If your tasks are taking a long time, or are retrying, the flow run will still be Running
while that is happening, thus taking a concurrency slot.karteekaddanki
07/20/2020, 3:01 PMAlex Cano
07/20/2020, 3:10 PMFlowRunTask
, but that’d mean making a new flow just to do the backfill, which is likely more overhead than most people would want.karteekaddanki
07/20/2020, 3:18 PMFlowRunTask
if there was a way to pass the context to the flows. All my backfills require date to be modified in context (and not as a parameter because of target caching) and I cannot change that bit right now.Alex Cano
07/20/2020, 3:20 PMkarteekaddanki
07/20/2020, 3:25 PMAlex Cano
07/20/2020, 3:26 PMkarteekaddanki
07/20/2020, 3:33 PMargparse
bits of the code for simplicity. Essentially, this is the script I am running. The Flow id corresponds to a flow with one trivial task and shouldn't take more than a second to run.Alex Cano
07/20/2020, 3:37 PMkarteekaddanki
07/20/2020, 3:44 PMfoobar
example.Alex Cano
07/20/2020, 3:56 PMLaura Lorenz (she/her)
07/20/2020, 5:35 PMLaura Lorenz (she/her)
07/21/2020, 3:55 PMFlowRunTask
is incoming (https://github.com/PrefectHQ/prefect/pull/3005) which should also address your original need for context
being exposed with that task library task soon 🙂karteekaddanki
07/21/2020, 5:19 PMkarteekaddanki
07/21/2020, 5:30 PMFlowRunTask.run
function. It'd be cleaner to give backfills a human-readable name (with a time based suffix like BUG-123_20200720
).