View Source Spawn.Cluster.Provisioner.Scheduler (spawn v2.0.0-RC1)
The Spawn.Cluster.Provisioner.Scheduler
module is responsible for scheduling tasks and invoking functions in a distributed actor system.
It handles creating worker pools and executing functions with the given task configuration.
This module also contains an implementation of the Executor
protocol for the SpawnTask
struct,
defining the execution behavior for tasks in the context of provisioning actors in the cluster.
Summary
Functions
Schedules and invokes a task for actor provisioning in another k8s POD.
Functions
Schedules and invokes a task for actor provisioning in another k8s POD.
This function wraps the scheduling logic by leveraging the Executor
protocol to execute the provided
function (func
). The function is called with the invocation
, opts
, and state
details encapsulated in a SpawnTask
struct.
Parameters
actor_name
: The actor name reference used to create the worker pool for the task execution.invocation
: The details of the invocation, typically containing metadata about the actor's execution.opts
: Options passed along with the task, which may modify how the invocation is performed.state
: The current state of the process, to be passed to the function being invoked.func
: A function that will be called with the{invocation, opts}
tuple and the currentstate
.
Example
task = %SpawnTask{
actor: actor,
invocation: invocation,
opts: opts,
state: state
}
Spawn.Cluster.Provisioner.Scheduler.schedule_and_invoke(task, &some_function/2)