MCPcopy Create free account
hub / github.com/astercloud/aster / CleanupTask

Method CleanupTask

pkg/tools/builtin/task_manager.go:331–355  ·  view source on GitHub ↗

CleanupTask 清理任务相关文件

(taskID string)

Source from the content-addressed store, hash-verified

329
330// CleanupTask 清理任务相关文件
331func (tm *FileTaskManager) CleanupTask(taskID string) error {
332 tm.mu.Lock()
333 defer tm.mu.Unlock()
334
335 task, exists := tm.tasks[taskID]
336 if !exists {
337 return fmt.Errorf("task not found: %s", taskID)
338 }
339
340 // 删除输出文件
341 outputFile := filepath.Join(task.Options.OutputDir, taskID+".stdout")
342 errorFile := filepath.Join(task.Options.OutputDir, taskID+".stderr")
343
344 _ = os.Remove(outputFile)
345 _ = os.Remove(errorFile)
346
347 // 删除任务信息
348 delete(tm.tasks, taskID)
349
350 // 删除任务文件
351 taskFile := filepath.Join(tm.dataDir, taskID+".json")
352 _ = os.Remove(taskFile)
353
354 return nil
355}
356
357// buildCommand 构建命令
358func (tm *FileTaskManager) buildCommand(cmd string, opts *TaskOptions) string {

Callers 1

cleanupRoutineMethod · 0.95

Calls 3

deleteFunction · 0.85
JoinMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected