MCPcopy Create free account
hub / github.com/actiontech/dtle / RecoverTask

Method RecoverTask

driver/driver.go:544–569  ·  view source on GitHub ↗
(handle *drivers.TaskHandle)

Source from the content-addressed store, hash-verified

542}
543
544func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error {
545 // See docker / raw_exec driver. 'Recover' means 'reattach'.
546 // Nomad client has crashed but the container/process keeps running.
547 // On nomad client restarting, it tries to reattach to running container/process.
548 // A dtle task crashes with nomad client, so it is not recoverable.
549
550 if handle == nil {
551 return fmt.Errorf("handle cannot be nil")
552 }
553
554 // COMPAT(0.10): pre 0.9 upgrade path check
555 /*if handle.Version == 0 {
556 return d.recoverPre09Task(handle)
557 }*/
558
559 cfg := handle.Config
560 d.logger.Info("RecoverTask", "ID", cfg.ID)
561
562 // If already attached to handle there's nothing to recover.
563 if _, ok := d.tasks.Get(cfg.ID); ok {
564 d.logger.Debug("nothing to recover; task already exists", "task_id", cfg.ID, "task_name", cfg.Name)
565 return nil
566 }
567
568 return fmt.Errorf("dtle task is not recoverable. intended. NOT an error")
569}
570
571func (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error) {
572 d.logger.Info("StartTask", "ID", cfg.ID, "allocID", cfg.AllocID, "jobName", cfg.JobName, "taskName", cfg.Name)

Callers

nothing calls this directly

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected