mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-28 17:50:56 +01:00
added batch restart tasks
This commit is contained in:
@@ -39,7 +39,7 @@ task:
|
||||
workers: 16
|
||||
other:
|
||||
tmppath: "/tmp"
|
||||
version: 0.4.10
|
||||
version: 0.5.0
|
||||
setting:
|
||||
crawlabLogToES: "N" # Send crawlab runtime log to ES, open this option "Y", remember to set esClient
|
||||
crawlabLogIndex: "crawlab-log"
|
||||
|
||||
@@ -252,6 +252,7 @@ func main() {
|
||||
authGroup.GET("/tasks/:id/results/download", routes.DownloadTaskResultsCsv) // 下载任务结果
|
||||
authGroup.POST("/tasks/:id/restart", routes.RestartTask) // 重新开始任务
|
||||
authGroup.POST("/tasks-cancel", routes.CancelSelectedTask) // 批量取消任务
|
||||
authGroup.POST("/tasks-restart", routes.RestartSelectedTask) // 批量重试任务
|
||||
}
|
||||
// 定时任务
|
||||
{
|
||||
|
||||
@@ -380,6 +380,22 @@ func CancelSelectedTask(c *gin.Context) {
|
||||
HandleSuccess(c)
|
||||
}
|
||||
|
||||
func RestartSelectedTask(c *gin.Context) {
|
||||
ids := make(map[string][]string)
|
||||
if err := c.ShouldBindJSON(&ids); err != nil {
|
||||
HandleError(http.StatusBadRequest, c, err)
|
||||
return
|
||||
}
|
||||
list := ids["ids"]
|
||||
for _, id := range list {
|
||||
if err := services.RestartTask(id, services.GetCurrentUserId(c)); err != nil {
|
||||
HandleError(http.StatusInternalServerError, c, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
HandleSuccess(c)
|
||||
}
|
||||
|
||||
// @Summary Get task log
|
||||
// @Description Get task log
|
||||
// @Tags task
|
||||
|
||||
Reference in New Issue
Block a user