1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-12 23:36:44 +00:00

support stop

This commit is contained in:
2019-04-18 17:25:37 +08:00
parent 1504c71fb4
commit 549e559a73
5 changed files with 43 additions and 9 deletions

View File

@@ -162,3 +162,18 @@ func (jm *JobManager) status() MsgJobStatus {
return MsgJobStatus{Status: tasksStatus}
}
func (jm *JobManager) stop() MsgStop {
for _, taskStatus := range jm.jobStatus.tasks {
spider := Spider{}
spider.Method = "POST"
spider.URL = "http://" + taskStatus.Node + ":8000/stop?id=" + taskStatus.Id
spider.do()
}
for i := range jm.resources {
jm.allocator.returnResource(jm.resources[i])
}
jm.allocator.finish(&jm.job)
return MsgStop{Code: 0}
}