Ejemplo n.º 1
0
func markHostRunningTaskFinished(h *host.Host, task *model.Task, newTaskId string) {
	// update the given host's running_task field accordingly
	if err := h.UpdateRunningTask(task.Id, newTaskId, time.Now()); err != nil {
		evergreen.Logger.Errorf(slogger.ERROR, "Error updating running task "+
			"%v on host %v to '': %v", task.Id, h.Id, err)
	}
}
Ejemplo n.º 2
0
// clean up a task whose heartbeat has timed out
func cleanUpTimedOutHeartbeat(task model.Task, project model.Project, host *host.Host) error {
	// mock up the failure details of the task
	detail := &apimodels.TaskEndDetail{
		Description: model.AgentHeartbeat,
		TimedOut:    true,
	}

	// try to reset the task
	if err := task.TryReset("", RunnerName, &project, detail); err != nil {
		return fmt.Errorf("error trying to reset task %v: %v", task.Id, err)
	}

	// clear out the host's running task
	if err := host.UpdateRunningTask(task.Id, "", time.Now()); err != nil {
		return fmt.Errorf("error clearing running task %v from host %v: %v",
			task.Id, host.Id, err)
	}

	// success
	return nil
}