EnvironmentWorkQueue
@Component public class EnvironmentWorkQueue
io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:30–227环境 Work 队列,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 enqueue、poll、ack、stop、heartbeat、get。
Hands work-queue facade. Durability is provided by CoordinationStore so Brain replicas
and out-of-process workers share the same queued/starting/active rows.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Status | 枚举enum | 定义状态的枚举。 A enum in io.agentscope.builder.web.managed that defines enum values used when components deploys, schedules and serves agents. |
WorkItem | 类class | Work 条目,承载智能体的部署、调度与服务化运行。 A class in io.agentscope.builder.web.managed that deploys, schedules and serves agents. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public EnvironmentWorkQueue(CoordinationStore coordinationStore) | 初始化 `EnvironmentWorkQueue` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
EnvironmentWorkQueue
public EnvironmentWorkQueue(CoordinationStore coordinationStore)
初始化 EnvironmentWorkQueue 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
coordinationStore | CoordinationStore | coordination 存储(类型 `CoordinationStore`)。The coordination store. |
io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:169–171方法详情Method Detail
enqueue
public WorkItem enqueue(String sessionId, String environmentId, String ownerId)
执行 enqueue 方法。
Performs the enqueue operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionId | String | 会话标识(类型 `String`)。The session id. |
environmentId | String | 环境标识(类型 `String`)。The environment id. |
ownerId | String | 所有者标识(类型 `String`)。The owner id. |
WorkItemio/agentscope/builder/web/managed/EnvironmentWorkQueue.java:173–175poll
public Optional<WorkItem> poll(String environmentId, String workerId, long timeoutMs) throws InterruptedException
执行 poll 方法。
Performs the poll operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
workerId | String | 工作进程标识(类型 `String`)。The worker id. |
timeoutMs | long | 超时 Ms(类型 `long`)。The timeout ms. |
Optional<WorkItem>InterruptedException可能抛出 `InterruptedException`。Thrown when the operation cannot be completed.
io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:177–180ack
public void ack(String leaseId, String workerId, String workDir)
执行确认相关操作。
Performs the ack operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leaseId | String | lease 标识(类型 `String`)。The lease id. |
workerId | String | 工作进程标识(类型 `String`)。The worker id. |
workDir | String | work 目录(类型 `String`)。The work dir. |
io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:182–184stop
public void stop(String leaseId)
设置停止。
Performs the stop operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leaseId | String | lease 标识(类型 `String`)。The lease id. |
io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:186–188heartbeat
public void heartbeat(String leaseId)
设置心跳。
Performs the heartbeat operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leaseId | String | lease 标识(类型 `String`)。The lease id. |
io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:190–192get
public Optional<WorkItem> get(String leaseId)
按条件读取数据。
Performs the get operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
leaseId | String | lease 标识(类型 `String`)。The lease id. |
Optional<WorkItem>io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:194–196list
public List<WorkItem> list(String environmentId, String statusFilter)
执行列表相关操作。
Performs the list operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
statusFilter | String | 状态过滤器(类型 `String`)。The status filter. |
List<WorkItem>io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:198–202stats
public CoordinationStore.WorkStats stats(String environmentId)
设置该参数。
Performs the stats operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
environmentId | String | 环境标识(类型 `String`)。The environment id. |
CoordinationStore.WorkStatsio/agentscope/builder/web/managed/EnvironmentWorkQueue.java:204–206registerWorker
public void registerWorker(String workerId, Object capabilities)
注册工作进程。
Registers the worker.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
workerId | String | 工作进程标识(类型 `String`)。The worker id. |
capabilities | Object | 能力(类型 `Object`)。The capabilities. |
io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:208–218workerHeartbeats
public Map<String, Long> workerHeartbeats()
返回 workerHeartbeats 结果。
Returns the worker heartbeats.
Map<String, Long>io/agentscope/builder/web/managed/EnvironmentWorkQueue.java:220–222pendingCount
public int pendingCount()
返回待处理数量。
Returns the pending count.
intio/agentscope/builder/web/managed/EnvironmentWorkQueue.java:224–226嵌套类详情Nested Class Detail
Status
public enum Status定义状态的枚举。位于 io.agentscope.builder.web.managed 包。核心成员包括 queued、starting、active、stopping、stopped。
A enum in io.agentscope.builder.web.managed that defines enum values used when components deploys, schedules and serves agents. Declared in io.agentscope.builder.web.managed.
WorkItem
public static final class WorkItemWork 条目,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 withMetadata、id、workId、leaseId、sessionId、environmentId。
A class in io.agentscope.builder.web.managed that deploys, schedules and serves agents. Declared in io.agentscope.builder.web.managed.