// stopStartTask updates the number of running tasks using the Marathon API. func (m *MarathonScheduler) stopStartTask(task *demand.Task) (blocked bool, err error) { // Scale app using the Marathon REST API. status, err := updateApp(m.baseMarathonURL, task.Name, task.Demand) if err != nil { return blocked, err } switch status { case 200: // Update was successful task.Requested = task.Demand case 409: // Deployment is locked and we need to back off log.Debugf("Deployment locked") blocked = true default: err = fmt.Errorf("Error response code %d from Marathon API", status) } return blocked, err }