/// <summary> /// 清理脱离控制的任务结果合并进程 /// </summary> /// <param name="collectTaskResultProcess">Collect task result process.</param> private void CleanOutOfControlCollectTaskResultProcess(IEnumerable <string[]> collectTaskResultProcess, CancellationToken cancellationToken = default) { foreach (var processInfo in collectTaskResultProcess) { var processId = int.Parse(processInfo[1]); var jobName = processInfo[2]; var jobId = processInfo[3]; LogWriter.Write(string.Format("正在处理:{0},{1}", jobName, jobId)); var jobRecord = _cluster.ConfigCenter.GetJobRecord(jobName, jobId, _cluster, cancellationToken); // 作业不存在了,看看作业任务合并进程还在不在 if (jobRecord == null) { LogWriter.Write("作业记录不存在了,尝试关闭废弃的任务合并进程"); SwiftProcess.KillAbandonedCollectTaskResultProcess(processId, jobName, jobId); continue; } LogWriter.Write(string.Format("作业记录存在")); // 任务非TaskMerging状态,看看进程在不在 if (jobRecord.Status != EnumJobRecordStatus.TaskMerging) { LogWriter.Write("任务非TaskMerging状态,尝试关闭废弃的任务合并进程"); SwiftProcess.KillAbandonedCollectTaskResultProcess(processId, jobName, jobId); continue; } LogWriter.Write(string.Format("作业在TaskMerging状态,将继续运行")); } }
/// <summary> /// 清理任务合并进程 /// </summary> /// <param name="collectTaskResultProcess">Collect task result process.</param> private void CleanOutOfControlCollectTaskResultProcess(IEnumerable <string[]> collectTaskResultProcess) { LogWriter.Write("Worker不应该执行任务合并进程,他们都应该被Kill"); foreach (var processInfo in collectTaskResultProcess) { var processId = int.Parse(processInfo[1]); var jobName = processInfo[2]; var jobId = processInfo[3]; LogWriter.Write(string.Format("正在处理:{0},{1}", jobName, jobId)); SwiftProcess.KillAbandonedCollectTaskResultProcess(processId, jobName, jobId); } }