public string TaskCreate(ulong SequenceId, Packs Package, CONST.LaunchMode LaunchMode, TaskFileDescription[] InputFiles, TaskFileDescription[] OutputFiles, string[] ParamKeys, string[] ParamValues) { lock (_taskServiceLock) { Task task = new Task(SequenceId, Package, LaunchMode, InputFiles, OutputFiles); if (ParamKeys != null && ParamKeys.Length > 0) { if (ParamKeys.Length != ParamValues.Length) throw new Exception("Param keys and values lengths must be equal!"); int length = ParamKeys.Length; for (int i = 0; i < length; i++) task.Params[ParamKeys[i]] = ParamValues[i]; } Log.Debug(String.Format( "Цепочка {0}: создана задача {1}", SequenceId, task.TaskId )); task.Save(); return task.TaskId; } }
public IEnumerable <TaskFileDescription> GetOutputFiles() { var outFiles = new List <TaskFileDescription>(); Log.Debug("Moving output files to storage"); Log.Debug("Moving FTP files"); foreach (var fileFromFtp in _filesToCopyFromFTP) { TaskFileDescription descr = fileFromFtp.Item1; string ftpPath = _ftpRoot + fileFromFtp.Item2; string storagePath = _storageRoot + descr.FileName; descr.StorageId = IOProxy.Storage.Upload(ftpPath, storagePath); outFiles.Add(descr); } Log.Debug("Moving local files"); foreach (var fileFromTmp in _filesToCopyFromTmp) { TaskFileDescription descr = fileFromTmp.Item1; string tmpPath = fileFromTmp.Item2; string storagePath = _storageRoot + descr.FileName; descr.StorageId = IOProxy.Storage.Upload(tmpPath, storagePath); outFiles.Add(descr); } Log.Debug("Moving output files to storage done"); Cleanup(); return(outFiles); }
public IEnumerable <TaskFileDescription> GetInputFiles() { var inputFiles = new List <TaskFileDescription>(_filesToCopyFromStorage); Log.Debug("Uploading input files created by PB"); foreach (var fileFromTmp in _filesToCopyFromTmp) { TaskFileDescription descr = fileFromTmp.Item1; string tmpPath = fileFromTmp.Item2; string storagePath = _storageRoot + descr.FileName; descr.StorageId = IOProxy.Storage.Upload(tmpPath, storagePath); inputFiles.Add(descr); } Log.Debug("Uploading input files done"); return(inputFiles); }
public TaskDescription(TaskDescription other) { WfId = String.IsNullOrEmpty(other.WfId)? "0" : other.WfId; TaskId = other.TaskId; UserId = other.UserId; // todo : userId == null? UserCert = other.UserCert; Priority = other.Priority; LaunchMode = other.LaunchMode; Package = other.Package; Method = other.Method ?? ""; if (other.Params != null) { Params = new Dictionary <string, string>(other.Params); } else { Params = new Dictionary <string, string>(); } if (other.ExecParams != null) { ExecParams = new Dictionary <string, string>(other.ExecParams); } else { ExecParams = new Dictionary <string, string>(); } if (other.InputFiles != null) // todo: inputs.ToArray()? { var inputsList = other.InputFiles.ToList(); int len = inputsList.Count(); InputFiles = new TaskFileDescription[len]; for (int i = 0; i < len; i++) { InputFiles[i] = new TaskFileDescription { FileName = inputsList[i].FileName, SlotName = inputsList[i].SlotName, StorageId = inputsList[i].StorageId, }; } } else { InputFiles = new TaskFileDescription[0]; // todo : is it ok? } if (other.OutputFiles != null) { var outputsList = other.OutputFiles.ToList(); int len = outputsList.Count(); OutputFiles = new TaskFileDescription[len]; for (int i = 0; i < len; i++) { OutputFiles[i] = new TaskFileDescription { FileName = outputsList[i].FileName, SlotName = outputsList[i].SlotName, StorageId = outputsList[i].StorageId, }; } } else { OutputFiles = new TaskFileDescription[0]; // todo : is it ok? } }
public double EstimateTime(Packs Package, CONST.LaunchMode LaunchMode, TaskFileDescription[] InputFiles, TaskFileDescription[] OutputFiles, string[] ParamKeys, string[] ParamValues) { string taskId = TaskCreate(0, Package, LaunchMode, InputFiles, OutputFiles, ParamKeys, ParamValues); return TaskEstimateTime(taskId); }
public TaskDescription(TaskDescription other) { WfId = String.IsNullOrEmpty(other.WfId)? "0" : other.WfId; TaskId = other.TaskId; UserId = other.UserId; // todo : userId == null? UserCert = other.UserCert; Priority = other.Priority; LaunchMode = other.LaunchMode; Package = other.Package; Method = other.Method ?? ""; if (other.Params != null) Params = new Dictionary<string, string>(other.Params); else Params = new Dictionary<string, string>(); if (other.ExecParams != null) ExecParams = new Dictionary<string, string>(other.ExecParams); else ExecParams = new Dictionary<string, string>(); if (other.InputFiles != null) // todo: inputs.ToArray()? { var inputsList = other.InputFiles.ToList(); int len = inputsList.Count(); InputFiles = new TaskFileDescription[len]; for (int i=0; i<len; i++) { InputFiles[i] = new TaskFileDescription { FileName = inputsList[i].FileName, SlotName = inputsList[i].SlotName, StorageId = inputsList[i].StorageId, }; } } else InputFiles = new TaskFileDescription[0]; // todo : is it ok? if (other.OutputFiles != null) { var outputsList = other.OutputFiles.ToList(); int len = outputsList.Count(); OutputFiles = new TaskFileDescription[len]; for (int i=0; i<len; i++) { OutputFiles[i] = new TaskFileDescription { FileName = outputsList[i].FileName, SlotName = outputsList[i].SlotName, StorageId = outputsList[i].StorageId, }; } } else OutputFiles = new TaskFileDescription[0]; // todo : is it ok? }
public IncarnationParams() { FilesToCopy = new TaskFileDescription[0]; ExpectedOutputFileNames = new string[0]; CanExpectMoreFiles = false; }