コード例 #1
0
ファイル: RunYPJob.cs プロジェクト: her123/APSIM.Cloud
        /// <summary>Zips the files.</summary>
        /// <param name="intoFileName">The name of the file to create.</param>
        /// <param name="fileNames">The file names to zip.</param>
        private static void ZipFiles(string[] fileNames, string intoFileName)
        {
            // Zip up files.
            ZipUtilities.ZipFiles(fileNames, null, intoFileName);

            // Delete the .met files.
            foreach (string fileName in fileNames)
            {
                File.Delete(fileName);
            }
        }
コード例 #2
0
        /// <summary>Called when all jobs completed</summary>
        public void Completed()
        {
            // Look for an error log file. Seems the error file gets written to the AusFarm
            // directory rather than the same place as the .sdml.
            Errors = new List <string>();
            foreach (string errorFile in Directory.GetFiles(binFolder, "*_errors.log"))
            {
                Errors.Add(File.ReadAllText(errorFile));
                File.Delete(errorFile);
            }

            // Zip the temporary directory
            AllFilesZipped = new MemoryStream();
            ZipUtilities.ZipFiles(Directory.GetFiles(workingDirectory), null, AllFilesZipped);

            // Get rid of our temporary directory.
            Directory.Delete(workingDirectory, true);
        }
コード例 #3
0
ファイル: RunYPJob.cs プロジェクト: her123/APSIM.Cloud
        /// <summary>Called when all jobs completed</summary>
        public void Completed()
        {
            // Perform cleanup and get outputs.
            Outputs = PerformCleanup(WorkingDirectory);

            // Look for error files - apsimx produces these.
            Errors = new List <string>();
            foreach (string errorFile in Directory.GetFiles(WorkingDirectory, "*.error"))
            {
                string error = string.Empty;
                foreach (string line in File.ReadAllLines(errorFile))
                {
                    if (!line.StartsWith("File:") && !line.StartsWith("Finished running simulations"))
                    {
                        error += line;
                    }
                }
                if (error != string.Empty)
                {
                    Errors.Add(error);
                }
            }

            // Look for error table - apsim classic produces these.
            if (Outputs.Tables.Contains("Error"))
            {
                DataTable errorTable = Outputs.Tables["Error"];
                foreach (DataRow errorRow in errorTable.Rows)
                {
                    Errors.Add(errorRow["Text"].ToString());
                }
            }

            // Zip the temporary directory
            AllFilesZipped = new MemoryStream();
            ZipUtilities.ZipFiles(Directory.GetFiles(WorkingDirectory), null, AllFilesZipped);

            // Get rid of our temporary directory.
            Directory.Delete(WorkingDirectory, true);
        }