MCPcopy
hub / github.com/determined-ai/determined / sender

Method sender

agent/internal/agent.go:273–296  ·  view source on GitHub ↗
(out chan *aproto.MasterMessage)

Source from the content-addressed store, hash-verified

271}
272
273func (a *Agent) sender(out chan *aproto.MasterMessage) events.Publisher[container.Event] {
274 return events.FuncPublisher[container.Event](
275 func(ctx context.Context, in container.Event) error {
276 var msg aproto.MasterMessage
277 switch {
278 case in.StateChange != nil:
279 msg.ContainerStateChanged = in.StateChange
280 case in.StatsRecord != nil:
281 msg.ContainerStatsRecord = in.StatsRecord
282 case in.Log != nil:
283 msg.ContainerLog = a.enrichLog(in.Log)
284 default:
285 panic(fmt.Sprintf("unknown outgoing message: %+v", in))
286 }
287
288 select {
289 case out <- &msg:
290 return nil
291 case <-ctx.Done():
292 return ctx.Err()
293 }
294 },
295 )
296}
297
298func (a *Agent) enrichLog(log *aproto.ContainerLog) *aproto.ContainerLog {
299 log.AgentID = &a.opts.AgentID

Callers 1

runMethod · 0.95

Calls 2

enrichLogMethod · 0.95
ErrMethod · 0.80

Tested by

no test coverage detected