IAgentScheduler Interface
Agent scheduler distributes a set of tasks/variables across connected clients.
To use, import via @fluidframework/agent-scheduler/legacy
.
For more information about our API support guarantees, see here.
Signature
export interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable
Extends: IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable
Methods
Method | Alerts | Return Type | Description |
---|---|---|---|
pick(taskId, worker) | Alpha |
Promise<void> |
Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus. Resolves when the tasks are assigned to one of the connected clients. This method should only be called once per task. Duplicate calls will be rejected. |
pickedTasks() | Alpha |
string[] | Returns a list of all tasks running on this client |
register(taskUrls) | Alpha |
Promise<void> |
Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants a new agent to run but does not have the capability to run the agent inside the host. Client can call pick() later if the capability changes. This method should only be called once per task. Duplicate calls will be rejected. |
release(taskUrls) | Alpha |
Promise<void> |
Releases a set of tasks for other clients to grab. Resolves when the tasks are released. Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection. App can call pickedTasks() to get the picked list first. |
Method Details
pick
Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus. Resolves when the tasks are assigned to one of the connected clients.
This method should only be called once per task. Duplicate calls will be rejected.
To use, import via @fluidframework/agent-scheduler/alpha
.
For more information about our API support guarantees, see here.
Signature
pick(taskId: string, worker: () => Promise<void>): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
taskId | string | |
worker | () => Promise<void> | callback to run when task is picked up. |
Returns
Return type: Promise<void>
pickedTasks
Returns a list of all tasks running on this client
To use, import via @fluidframework/agent-scheduler/alpha
.
For more information about our API support guarantees, see here.
Signature
pickedTasks(): string[];
Returns
Return type: string[]
register
Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants a new agent to run but does not have the capability to run the agent inside the host. Client can call pick() later if the capability changes.
This method should only be called once per task. Duplicate calls will be rejected.
To use, import via @fluidframework/agent-scheduler/alpha
.
For more information about our API support guarantees, see here.
Signature
register(...taskUrls: string[]): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
taskUrls | string[] |
Returns
Return type: Promise<void>
release
Releases a set of tasks for other clients to grab. Resolves when the tasks are released.
Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection. App can call pickedTasks() to get the picked list first.
To use, import via @fluidframework/agent-scheduler/alpha
.
For more information about our API support guarantees, see here.
Signature
release(...taskUrls: string[]): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
taskUrls | string[] |
Returns
Return type: Promise<void>