Constantin Teo
10/16/2024, 12:32 AM@task
s can be .delay
-ed , then why shouldn't @flow
?Constantin Teo
10/16/2024, 12:33 AMConstantin Teo
10/16/2024, 12:41 AMclass FleetController(ABC):
@task
async def reserve(self):
"""Client-invoked"""
...
@task
async def provision(self):
"""Worker-managed"""
@classmethod
@flow
async def on_reservation(cls, request) -> Reservation:
self = cls()
handle = self.provision()
request.callback(handle)
There could be different types of "fleets", which result in changes in logic and configurations; I assume this is the case for "deployments", but I'm trying to get a rough idea on how clients are expected to interact with deployments, which is the worker-side of the flowNate
10/16/2024, 4:13 AM@task
s can be .delay
-ed , then why shouldn't @flow
?
tl;dr some_task.delay(...)
results in a websocket client pushing a new TaskRun
to the server so a TaskWorker
elsewhere can execute it like these examples - whereas flows can be deployed or served so that scheduled runs of that deployment can be executed by a long-lived process polling for scheduled runs (e.g.) (.serve
is just an easy-mode "process" worker)
ie to tell a deployed flow to run elsewhere, you can:
• use run_deployment
to trigger it (via POST /create_flow_run_from_deployment
under the hood)
• use emit_event
to create the pre-requisite events for one of a deployment's triggers
Constantin Teo
10/23/2024, 5:46 PM