mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 08:55:43 +03:00
drivers: use consts for task handle version
This commit is contained in:
@@ -34,6 +34,10 @@ const (
|
||||
// The key populated in Node Attributes to indicate presence of the Java driver
|
||||
driverAttr = "driver.java"
|
||||
driverVersionAttr = "driver.java.version"
|
||||
|
||||
// taskHandleVersion is the version of task handle which this driver sets
|
||||
// and understands how to decode driver state
|
||||
taskHandleVersion = 1
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -255,7 +259,7 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return d.recoverPre0_9Task(handle.Config, reattachConfig)
|
||||
return d.recoverPre09task(handle.Config, reattachConfig)
|
||||
}
|
||||
|
||||
// If already attached to handle there's nothing to recover.
|
||||
@@ -325,7 +329,7 @@ func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drive
|
||||
|
||||
d.logger.Info("starting java task", "driver_cfg", hclog.Fmt("%+v", driverConfig), "args", args)
|
||||
|
||||
handle := drivers.NewTaskHandle(1)
|
||||
handle := drivers.NewTaskHandle(taskHandleVersion)
|
||||
handle.Config = cfg
|
||||
|
||||
pluginLogFile := filepath.Join(cfg.TaskDir().Dir, "executor.out")
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/hashicorp/nomad/plugins/drivers"
|
||||
)
|
||||
|
||||
func (d *Driver) recoverPre0_9Task(config *drivers.TaskConfig, reattach *plugin.ReattachConfig) error {
|
||||
func (d *Driver) recoverPre09task(config *drivers.TaskConfig, reattach *plugin.ReattachConfig) error {
|
||||
config.ID = fmt.Sprintf("pre09-%s", uuid.Generate())
|
||||
exec, pluginClient, err := executor.ReattachToPre09Executor(reattach,
|
||||
d.logger.With("task_name", config.Name, "alloc_id", config.AllocID))
|
||||
|
||||
Reference in New Issue
Block a user