public static string ResolveFilePath(GridJob job, GridJobTask task, GridJobFile file) { if (file.ShareMode == EGridJobFileShare.SharedBetweenTasks) { return($"{JobsDirectory}\\{job.Name}\\{file.FileName}"); } return($"{JobsDirectory}\\{job.Name}\\task-{task.TaskId}\\{file.FileName}"); }
public static void StoreJobTaskFile(GridJobTask task, GridJobFile file) { CreateTaskDirectoriesIfNotExists(task); var fp = $"{JobsDirectory}\\{task.ParentJob.Name}\\task-{task.TaskId}\\{file.FileName}"; if (file.ShareMode == EGridJobFileShare.SharedBetweenTasks) { fp = $"{JobsDirectory}\\{task.ParentJob.Name}\\{file.FileName}"; } File.WriteAllBytes(fp, file.Bytes); }
public static GridJobFile ImportFromExternal(string input, EGridJobFileDirection dir, EGridJobFileShare share) { if (!File.Exists(input)) { throw new Exception($"No such file {input}, you need to pass full path, not relative"); } var file = new GridJobFile { FileName = Path.GetFileName(input), InputPath = input, Direction = dir, ShareMode = share, Bytes = File.ReadAllBytes(input) }; file.CheckSum = CryptoUtils.CrcOfBytes(file.Bytes); return(file); }
public static bool IsJobTaskFileExistsAndValid(GridJobTask task, GridJobFile jobFile) { var fp = $"{JobsDirectory}\\{task.ParentJob.Name}\\{jobFile.FileName}"; if (jobFile.ShareMode == EGridJobFileShare.SharedBetweenTasks) { if (!File.Exists(fp)) { return(false); } return(CryptoUtils.CrcOfFile(fp) == jobFile.CheckSum); } fp = $"{JobsDirectory}\\{task.ParentJob.Name}\\task-{task.TaskId}\\{jobFile.FileName}"; if (!File.Exists(fp)) { return(false); } return(CryptoUtils.CrcOfFile(fp) == jobFile.CheckSum); }
public GridJobFileLink(GridJobFile file) { FileName = file.FileName; CheckSum = file.CheckSum; }
public string ResolveFilePath(GridJobTask task, GridJobFile file) { return(GridIo.ResolveFilePath(task.ParentJob, task, file)); }