Jason Bertman
09/29/2021, 7:38 PMimport os
from flows.wherever import flow
from prefect.executors import LocalDaskExecutor
from prefect.storage import Local
context = {
# ...
}
flow.executor = LocalDaskExecutor(scheduler="threads", num_workers=8)
flow.storage = Local()
state = flow.run(
param="something"
context=context,
)
This works fine, but doesn't seem to fly with flows that call StartFlowRun
, since it's trying to reach out to a server. Anyone have a way to do dependent flows locally? Not sure if the new local runner can do it, I haven't had the chance to try it yet 🙂Kevin Kho
Jason Bertman
09/30/2021, 12:13 PMKevin Kho
StartFlowRun
code is calling the API using the Client under the hood. For unit testing, it would need to be mocked. Maybe you could mock the behavior to import the flow locally then use the flow.run()
?Jason Bertman
09/30/2021, 4:35 PMJason Bertman
09/30/2021, 7:41 PMrun
's it in the same way (with new_flow_context
and parameters
)