tree: 5fe85048eddcb58900057b05adb3d15f509e7a23 [path history] [tgz]
  1. go/
  2. images/
  3. modules/
  4. pages/
  5. secrets/
  6. .eslintrc.js
  7. .gitignore
  8. BUILD.bazel
  9. karma.conf.ts
  10. Makefile
  11. README.md
  12. test_machine_monitor_cipd.yml
  13. tsconfig.json
machine/README.md

Machine Server

The machine state server is a centralized management application for device testing.

See the Design Doc.

Code structure

The main code is structure as:

go/machine/
    source/
    processor/
    store/

Where:

  • types contains the Go types used across the rest of the modules.
  • The source module contains source.Source, a way to get update events from machines.
  • The store module contains store.Store, a way to persist and retrieve each machine's state.
  • The processor module contains processor.Processor, a way to update a machine state from an incoming event.

The main loop of machine state server looks like:

for event := range eventCh {
	store.Update(ctx, event.Host.Name, func(previous machine.Description) machine.Description {
		return processor.Process(ctx, previous, event)
	})
}

test_machine_monitor

The application that runs on each switchboard test machine and feeds information into the machine state server.

See the Design Doc.

Current Data Flow

User triggers powercycle for a machine.

initiatormessagetargetnotes
machineserver>Set(ΔDescription)DBDescription.Powercycle=true
DB>Snapshot(ΔDescription)powercycle_server_ansible
powercycle_server_ansible>Set(ΔDescription)DBDescription.Powercycle=false

How test_machine_monitor keeps machine.Description up to date.

initiatormessagetargetnotes
test_machine_monitor>PubSub(Event)machineserverSends results from interrogate.
test_machine_monitor<Snapshot(Description)DB

Legend

  • initiator - The entity that starts the action.
  • message - Shows the direction of the data flow, the transport, and the struct being moved.
  • target - Who the iniator is talking to.
  • Δ is used before a struct if only a part of that struct is being changed.