Пример #1
0
        public byte[] OnTask(byte[] input)
        {
            // TODO: get shared data file name here
            string sharedDataFile = "some filename";

            DateTime tS = DateTime.Now;

            // TODO - implement config class!
            HPCUtilities.Init(HPCEnvironment.KubernetesAWS);

            TaskData td = HPCUtilities.Deserialize <TaskData>(input);

            Func <SharedJobData> getSJD = () =>
            {
                return(HPCUtilities.Deserialize <SharedJobData>(File.ReadAllBytes(sharedDataFile)));
            };

            JobDataUtilities.SetSharedJobData(td.Job, getSJD);

            ZOSTaskData taskSettings = HPCUtilities.Deserialize <ZOSTaskData>(td.Data[0].Data);

            byte[] resultData = JobDataUtilities.RunZOSJob(
                td,
                tS);

            return(resultData);
        }
Пример #2
0
        static void Main(string[] args)
        {
            // arguments
            // job id
            // shared data file
            // job data file
            // output file

            DateTime tS = DateTime.Now;

            // TODO - implement config class!
            HPCUtilities.Init(HPCEnvironment.KubernetesAWS);

            int numArgs = args.Length;

            if (numArgs < 4)
            {
                throw new Exception("Invalid number of arguments");
            }

            string jobId          = args[numArgs - 4];
            string sharedDataFile = args[numArgs - 3];
            string taskDataFile   = args[numArgs - 2];
            string outFile        = args[numArgs - 1];

            // TODO - shared data isn't needed for Prime factoring
            // For other jobs, it needs to be pre-processed once per node

            TaskData td = HPCUtilities.Deserialize <TaskData>(File.ReadAllBytes(taskDataFile));

            Func <SharedJobData> getSJD = () =>
            {
                return(HPCUtilities.Deserialize <SharedJobData>(File.ReadAllBytes(sharedDataFile)));
            };

            JobDataUtilities.SetSharedJobData(td.Job, getSJD);

            ZOSTaskData taskSettings = HPCUtilities.Deserialize <ZOSTaskData>(td.Data[0].Data);

            byte[] resultData = JobDataUtilities.RunZOSJob(
                td,
                tS);

            File.WriteAllBytes(outFile, resultData);

            //RunPrime1(td.Job, td.TaskNumber, taskSettings.NumberToFactor, outFile);
        }