MCPcopy Index your code
hub / github.com/mudler/LocalAI / newTaskSyncService

Function newTaskSyncService

core/services/agentpool/task_sync_test.go:28–44  ·  view source on GitHub ↗

newTaskSyncService builds an AgentJobService wired to the given bus and a throwaway data dir (so the file persister has somewhere to write). Model/config loaders are nil because the task sync paths under test never touch them.

(bus messaging.MessagingClient)

Source from the content-addressed store, hash-verified

26// throwaway data dir (so the file persister has somewhere to write). Model/config
27// loaders are nil because the task sync paths under test never touch them.
28func newTaskSyncService(bus messaging.MessagingClient) *AgentJobService {
29 tmpDir := GinkgoT().TempDir()
30 sysState := &system.SystemState{}
31 sysState.Model.ModelsPath = tmpDir
32 appConfig := config.NewApplicationConfig(
33 config.WithDynamicConfigDir(tmpDir),
34 config.WithContext(context.Background()),
35 )
36 appConfig.SystemState = sysState
37
38 svc := NewAgentJobServiceWithPaths(appConfig, nil, nil, nil,
39 // Distinct per-replica files so the file persister write-through never
40 // crosses replicas: convergence here must be proven via the bus alone.
41 tmpDir+"/tasks.json", tmpDir+"/jobs.json")
42 svc.SetTaskSyncNATS(bus)
43 return svc
44}
45
46var _ = Describe("AgentJobService task cross-replica sync", func() {
47 Describe("two replicas sharing one bus", func() {

Callers 1

task_sync_test.goFile · 0.85

Calls 5

NewApplicationConfigFunction · 0.92
WithDynamicConfigDirFunction · 0.92
WithContextFunction · 0.92
SetTaskSyncNATSMethod · 0.80

Tested by

no test coverage detected