Ejemplo n.º 1
0
        public CondorSubmitFile(IEnumerable<DtaFile> dtaFiles, UserModFile userModFile, IEnumerable<DatabaseFile> dbFiles)
            : base(Path.GetTempFileName())
        {
            Requirements = new List<string> {"(Arch == \"x86_64\")", "(TARGET.Name =!= LastMatchName1)", "(OpSys == \"LINUX\")", "(Disk > 500000)"};

            UserModFile = userModFile;
            DatabaseFiles = new List<DatabaseFile>(dbFiles);
            DtaFiles = new List<DtaFile>(dtaFiles);
            foreach (DtaFile dta in DtaFiles)
            {
                dta.UserModFile = userModFile;
            }
        }
Ejemplo n.º 2
0
        public CondorSubmitFile(IEnumerable <DtaFile> dtaFiles, UserModFile userModFile, IEnumerable <DatabaseFile> dbFiles)
            : base(Path.GetTempFileName())
        {
            Requirements = new List <string> {
                "(Arch == \"x86_64\")", "(TARGET.Name =!= LastMatchName1)", "(OpSys == \"LINUX\")", "(Disk > 500000)"
            };

            UserModFile   = userModFile;
            DatabaseFiles = new List <DatabaseFile>(dbFiles);
            DtaFiles      = new List <DtaFile>(dtaFiles);
            foreach (DtaFile dta in DtaFiles)
            {
                dta.UserModFile = userModFile;
            }
        }
Ejemplo n.º 3
0
        private async void Submit()
        {
            try
            {
                bool splitSpectra = checkBox1.Checked;
                int spectraToSplit = (int)numericUpDown1.Value;

                submitToolStripMenuItem.Enabled = false;
                dataGridView1.Enabled = false;
                string jobName = textBox1.Text;

                if (DtaFiles.Count == 0)
                {
                    throw new ArgumentNullException("DTA Files", "Please supply at least one DTA file for the submission");
                }

                if (string.IsNullOrWhiteSpace(jobName))
                {
                    throw new ArgumentNullException("Job Name", "Please supply a job name for the submission");
                }
                
                DatabaseFile[] dataBases = checkedListBox1.CheckedItems.Cast<DatabaseFile>().ToArray();
                if (dataBases.Length == 0)
                {
                    throw new ArgumentNullException("Database", "Please selected at least one database for the submission");
                }

                UserModFile userModFile = null;
                string userModFilePath = textBox2.Text;
                if (!string.IsNullOrWhiteSpace(userModFilePath))
                {
                    if (!System.IO.File.Exists(userModFilePath))
                    {
                        throw new FileNotFoundException("Unable to locate user mod file", userModFilePath);
                    }
                    userModFile = new UserModFile(userModFilePath);
                }

                string remoteJobDirectory = _connection.CreateDirectory(_connection.CondorFolder + jobName);
                
                if (userModFile != null)
                {
                    SetStatusLabel("Uploading User Mod File...");
                    await _connection.PutFileAsync(userModFile, remoteJobDirectory);
                }
                
                List<DtaFile> dtaFiles = new List<DtaFile>();
              
                if (splitSpectra)
                {
                    SetStatusLabel("Splitting Dta Files to contain " + spectraToSplit + " spectra each...");
                    Task t = new Task(() =>
                    {
                        foreach (DtaFile dtaFile in DtaFiles.Distinct())
                        {
                            dtaFiles.AddRange(dtaFile.Split(spectraToSplit));
                        }
                    });
                    t.Start();
                    await t;
                }
                else
                {
                    dtaFiles = DtaFiles.ToList();
                }

                SetStatusLabel("Uploading Files to " + remoteJobDirectory + "...");
                await _connection.PutFilesAsync(dtaFiles.Distinct(), remoteJobDirectory);
                
                SetStatusLabel("Uploading Submit File...");
                CondorSubmitFile submitFile = new CondorSubmitFile(dtaFiles, userModFile, dataBases);
                submitFile.WriteToDisk();
                
                await _connection.PutFileAsync(submitFile, remoteJobDirectory, "submitFile.condor");
                
                if (splitSpectra)
                {
                    foreach (DtaFile dtaFile in dtaFiles)
                    {
                        System.IO.File.Delete(dtaFile.FilePath);
                    }
                }

                System.IO.File.Delete(submitFile.FilePath);

                string result = _connection.RunSubmission(remoteJobDirectory, "submitFile.condor");
                
                SetStatusLabel(result.Replace("\n"," "));
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error Submitting Job", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                SetStatusLabel("Error");
            }
            finally
            {
                dataGridView1.Enabled = true;
                toolStripStatusLabel1.Text = "";
                submitToolStripMenuItem.Enabled = true;
                UpdateProgress(0);
            }
        }
Ejemplo n.º 4
0
        private async void Submit()
        {
            try
            {
                bool splitSpectra   = checkBox1.Checked;
                int  spectraToSplit = (int)numericUpDown1.Value;

                submitToolStripMenuItem.Enabled = false;
                dataGridView1.Enabled           = false;
                string jobName = textBox1.Text;

                if (DtaFiles.Count == 0)
                {
                    throw new ArgumentNullException("DTA Files", "Please supply at least one DTA file for the submission");
                }

                if (string.IsNullOrWhiteSpace(jobName))
                {
                    throw new ArgumentNullException("Job Name", "Please supply a job name for the submission");
                }

                DatabaseFile[] dataBases = checkedListBox1.CheckedItems.Cast <DatabaseFile>().ToArray();
                if (dataBases.Length == 0)
                {
                    throw new ArgumentNullException("Database", "Please selected at least one database for the submission");
                }

                UserModFile userModFile     = null;
                string      userModFilePath = textBox2.Text;
                if (!string.IsNullOrWhiteSpace(userModFilePath))
                {
                    if (!System.IO.File.Exists(userModFilePath))
                    {
                        throw new FileNotFoundException("Unable to locate user mod file", userModFilePath);
                    }
                    userModFile = new UserModFile(userModFilePath);
                }

                string remoteJobDirectory = _connection.CreateDirectory(_connection.CondorFolder + jobName);

                if (userModFile != null)
                {
                    SetStatusLabel("Uploading User Mod File...");
                    await _connection.PutFileAsync(userModFile, remoteJobDirectory);
                }

                List <DtaFile> dtaFiles = new List <DtaFile>();

                if (splitSpectra)
                {
                    SetStatusLabel("Splitting Dta Files to contain " + spectraToSplit + " spectra each...");
                    Task t = new Task(() =>
                    {
                        foreach (DtaFile dtaFile in DtaFiles.Distinct())
                        {
                            dtaFiles.AddRange(dtaFile.Split(spectraToSplit));
                        }
                    });
                    t.Start();
                    await t;
                }
                else
                {
                    dtaFiles = DtaFiles.ToList();
                }

                SetStatusLabel("Uploading Files to " + remoteJobDirectory + "...");
                await _connection.PutFilesAsync(dtaFiles.Distinct(), remoteJobDirectory);

                SetStatusLabel("Uploading Submit File...");
                CondorSubmitFile submitFile = new CondorSubmitFile(dtaFiles, userModFile, dataBases);
                submitFile.WriteToDisk();

                await _connection.PutFileAsync(submitFile, remoteJobDirectory, "submitFile.condor");

                if (splitSpectra)
                {
                    foreach (DtaFile dtaFile in dtaFiles)
                    {
                        System.IO.File.Delete(dtaFile.FilePath);
                    }
                }

                System.IO.File.Delete(submitFile.FilePath);

                string result = _connection.RunSubmission(remoteJobDirectory, "submitFile.condor");

                SetStatusLabel(result.Replace("\n", " "));
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error Submitting Job", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                SetStatusLabel("Error");
            }
            finally
            {
                dataGridView1.Enabled           = true;
                toolStripStatusLabel1.Text      = "";
                submitToolStripMenuItem.Enabled = true;
                UpdateProgress(0);
            }
        }