示例#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
        public GridJobTask GetTask()
        {
            var job  = GridJob.Deserialize(_jobSerialized);
            var task = GridJobTask.Deserialize(_jobTaskSerialized);

            task.ParentJob = job;
            return(task);
        }