File tree Expand file tree Collapse file tree 5 files changed +1335
-635
lines changed
Expand file tree Collapse file tree 5 files changed +1335
-635
lines changed Original file line number Diff line number Diff line change 33
44# devbuild compiles the binary
55# -----------------------------------
6- FROM golang:1.21 AS devbuild
6+ FROM golang:1.24 AS devbuild
77
88WORKDIR /build
99COPY . ./
1010ENV CGO_ENABLED=1
11- RUN go build -o nomad-nodesim .
11+ RUN go build -tags hashicorpmetrics - o nomad-nodesim .
1212
1313# dev runs the binary from devbuild
1414# -----------------------------------
Original file line number Diff line number Diff line change 22
33Nomad Client Node Simulator
44
5- To install and use you must have Go 1.19+ and run:
5+ To install and use you must have Go and run:
66
77```
8- go install -v github.com/schmichael/nomad-nodesim@latest
8+ go install -v -tags hashicorpmetrics github.com/schmichael/nomad-nodesim@latest
99
1010nomad-nodesim -help
1111```
Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ type simulatedAllocRunner struct {
4343 // lastAcknowledgedState is the alloc runner state that was last
4444 // acknowledged by the server. It may lag behind allocState.
4545 lastAcknowledgedState * state.State
46+
47+ pauseState structs.TaskScheduleState
4648}
4749
4850func NewEmptyAllocRunnerFunc (conf * config.AllocRunnerConfig ) (interfaces.AllocRunner , error ) {
@@ -482,7 +484,18 @@ func (ar *simulatedAllocRunner) GetUpdatePriority(alloc *structs.Allocation) cst
482484
483485func (ar * simulatedAllocRunner ) StatsReporter () interfaces.AllocStatsReporter { return ar }
484486func (ar * simulatedAllocRunner ) Listener () * cstructs.AllocListener { return nil }
485- func (ar * simulatedAllocRunner ) GetAllocDir () * allocdir.AllocDir { return nil }
487+ func (ar * simulatedAllocRunner ) GetAllocDir () allocdir.Interface { return nil }
488+ func (ar * simulatedAllocRunner ) GetTaskPauseState (string ) (structs.TaskScheduleState , error ) {
489+ ar .allocLock .RLock ()
490+ defer ar .allocLock .RUnlock ()
491+ return ar .pauseState , nil
492+ }
493+ func (ar * simulatedAllocRunner ) SetTaskPauseState (_ string , state structs.TaskScheduleState ) error {
494+ ar .allocLock .Lock ()
495+ defer ar .allocLock .Unlock ()
496+ ar .pauseState = state
497+ return nil
498+ }
486499
487500// LatestAllocStats lets this empty runner implement AllocStatsReporter
488501func (ar * simulatedAllocRunner ) LatestAllocStats (taskFilter string ) (* cstructs.AllocResourceUsage , error ) {
You can’t perform that action at this time.
0 commit comments