Update agents service to updated protocol (#2837)

- Deprecate namespace field
- Restore former semantic of starting a job for each registered namespace, for a given Agent Name
- Add agentName field
- Use "dispatcher" naming convention
This commit is contained in:
Benjamin Pracht
2024-07-08 17:09:11 -07:00
committed by GitHub
parent e4fba5634a
commit fb7eb3450e
10 changed files with 142 additions and 114 deletions
+9
View File
@@ -78,6 +78,7 @@ type Worker struct {
id string
jobType livekit.JobType
version string
agentName string
name string
namespace string
load float32
@@ -161,6 +162,12 @@ func (w *Worker) Namespace() string {
return w.namespace
}
func (w *Worker) AgentName() string {
w.mu.Lock()
defer w.mu.Unlock()
return w.agentName
}
func (w *Worker) Status() livekit.WorkerStatus {
w.mu.Lock()
defer w.mu.Unlock()
@@ -318,6 +325,7 @@ func (w *Worker) handleRegister(req *livekit.RegisterWorkerRequest) {
w.version = req.Version
w.name = req.Name
w.agentName = req.GetAgentName()
w.namespace = req.GetNamespace()
w.jobType = req.GetType()
@@ -408,6 +416,7 @@ func (w *Worker) handleSimulateJob(simulate *livekit.SimulateJobRequest) {
Room: simulate.Room,
Participant: simulate.Participant,
Namespace: w.Namespace(),
AgentName: w.AgentName(),
}
go func() {