wip
This commit is contained in:
parent
7ddc0eb65c
commit
c93cfc89c0
|
@ -196,8 +196,9 @@ func (ar *allocRunner) Alloc() *structs.Allocation {
|
|||
// *and* within Run -- *and* Updates are applid within Run -- we may be able to
|
||||
// skip quite a bit of locking? maybe?
|
||||
func (ar *allocRunner) SaveState() error {
|
||||
// XXX Do we move this to the client
|
||||
return ar.stateDB.Update(func(tx *bolt.Tx) error {
|
||||
//XXX Track EvalID to only write alloc on change?
|
||||
//XXX Track AllocModifyIndex to only write alloc on change?
|
||||
// Write the allocation
|
||||
return clientstate.PutAllocation(tx, ar.Alloc())
|
||||
})
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package allocrunnerv2
|
||||
|
||||
/*
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
|
@ -82,3 +84,4 @@ func TestAllocRunner_Postrun_Basic(t *testing.T) {
|
|||
require.True(post.run)
|
||||
require.False(pre.run)
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -5,13 +5,6 @@ import (
|
|||
"github.com/hashicorp/nomad/helper"
|
||||
)
|
||||
|
||||
var (
|
||||
// taskRunnerStateAllKey holds all the task runners state. At the moment
|
||||
// there is no need to split it
|
||||
//XXX refactor out of client/state and taskrunner
|
||||
taskRunnerStateAllKey = []byte("simple-all")
|
||||
)
|
||||
|
||||
// LocalState is Task state which is persisted for use when restarting Nomad
|
||||
// agents.
|
||||
type LocalState struct {
|
||||
|
@ -48,7 +41,7 @@ type HookState struct {
|
|||
// Prestart is true if the hook has run Prestart successfully and does
|
||||
// not need to run again
|
||||
PrestartDone bool
|
||||
Data map[string]string
|
||||
Data map[string]string
|
||||
}
|
||||
|
||||
func (h *HookState) Copy() *HookState {
|
||||
|
|
|
@ -473,6 +473,10 @@ func (tr *TaskRunner) persistLocalState() error {
|
|||
})
|
||||
}
|
||||
|
||||
// XXX If the objects don't exists since the client shutdown before the task
|
||||
// runner ever saved state, then we should treat it as a new task runner and not
|
||||
// return an error
|
||||
//
|
||||
// Restore task runner state. Called by AllocRunner.Restore after NewTaskRunner
|
||||
// but before Run so no locks need to be acquired.
|
||||
func (tr *TaskRunner) Restore(tx *bolt.Tx) error {
|
||||
|
@ -496,6 +500,10 @@ func (tr *TaskRunner) Restore(tx *bolt.Tx) error {
|
|||
}
|
||||
tr.state = &ts
|
||||
|
||||
// XXX if driver has task {
|
||||
// tr.restoreDriver()
|
||||
// }
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue