Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

# devbuild compiles the binary
# -----------------------------------
FROM golang:1.21 AS devbuild
FROM golang:1.24 AS devbuild

WORKDIR /build
COPY . ./
ENV CGO_ENABLED=1
RUN go build -o nomad-nodesim .
RUN go build -tags hashicorpmetrics -o nomad-nodesim .

# dev runs the binary from devbuild
# -----------------------------------
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Nomad Client Node Simulator

To install and use you must have Go 1.19+ and run:
To install and use you must have Go and run:

```
go install -v github.com/schmichael/nomad-nodesim@latest
go install -v -tags hashicorpmetrics github.com/schmichael/nomad-nodesim@latest

nomad-nodesim -help
```
Expand Down
15 changes: 14 additions & 1 deletion allocrunnersim/allocrunnersim.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type simulatedAllocRunner struct {
// lastAcknowledgedState is the alloc runner state that was last
// acknowledged by the server. It may lag behind allocState.
lastAcknowledgedState *state.State

pauseState structs.TaskScheduleState
}

func NewEmptyAllocRunnerFunc(conf *config.AllocRunnerConfig) (interfaces.AllocRunner, error) {
Expand Down Expand Up @@ -482,7 +484,18 @@ func (ar *simulatedAllocRunner) GetUpdatePriority(alloc *structs.Allocation) cst

func (ar *simulatedAllocRunner) StatsReporter() interfaces.AllocStatsReporter { return ar }
func (ar *simulatedAllocRunner) Listener() *cstructs.AllocListener { return nil }
func (ar *simulatedAllocRunner) GetAllocDir() *allocdir.AllocDir { return nil }
func (ar *simulatedAllocRunner) GetAllocDir() allocdir.Interface { return nil }
func (ar *simulatedAllocRunner) GetTaskPauseState(string) (structs.TaskScheduleState, error) {
ar.allocLock.RLock()
defer ar.allocLock.RUnlock()
return ar.pauseState, nil
}
func (ar *simulatedAllocRunner) SetTaskPauseState(_ string, state structs.TaskScheduleState) error {
ar.allocLock.Lock()
defer ar.allocLock.Unlock()
ar.pauseState = state
return nil
}

// LatestAllocStats lets this empty runner implement AllocStatsReporter
func (ar *simulatedAllocRunner) LatestAllocStats(taskFilter string) (*cstructs.AllocResourceUsage, error) {
Expand Down
Loading