예제 #1
0
        private void HandleJobTestLoad(string[] args)
        {
            var jobFileName = args.Length <= 0 ? "job-generated.json" : args[0];
            var job         = GridJob.Deserialize(File.ReadAllText(jobFileName));

            foreach (var task in job.JobTasks)
            {
                task.ParentJob = job;
            }

            GridIo.CreateDirectoriesForJob(job);

            foreach (var file in job.JobFiles)
            {
                if (file.Direction == EGridJobFileDirection.WorkerInput)
                {
                    var localPath = GridIo.ResolveFilePath(job, null, file);
                    file.Bytes = File.ReadAllBytes(localPath);
                    file.UpdateCheckSum();
                }
            }

            if (Server.IsAnyJobActive())
            {
                Logger.Warn($"Server has already executing job {Server.GetActiveJob()}, new job will be added to the queue");
            }

            Logger.Info($"Queue new job {job}");
            Server.RunQueueJob(job);
        }
예제 #2
0
        private void SendOutputFiles()
        {
            var outFiles = _activeTask.ParentJob.JobFiles.Where(x => x.Direction == EGridJobFileDirection.WorkerOutput);

            foreach (var outFile in outFiles)
            {
                outFile.Bytes    = File.ReadAllBytes(GridIo.ResolveFilePath(_activeTask, outFile));
                outFile.CheckSum = CryptoUtils.CrcOfBytes(outFile.Bytes);
                _networkSystem.SendPacket(new PacketWorkerFileData(_activeTask, outFile));
            }
        }