Exemple #1
0
        private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            SubmissionWorker w = (SubmissionWorker)sender;

            pbars[w.id].BeginAnimation(System.Windows.Controls.ProgressBar.ValueProperty, null);
            pbars[w.id].Value = e.ProgressPercentage;
        }
Exemple #2
0
        public Submission(SqlConnection sql) // Disconnect ...
        {
            InitializeComponent();
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            Title = "Disconnecting...";

            WindowInteropHelper helper = new WindowInteropHelper(this);
            SubmissionWorker    w      = new SubmissionWorker(helper.Handle, workers.Count());

            w.DoWork                    += new DoWorkEventHandler(worker_DoWork);
            w.ProgressChanged           += new ProgressChangedEventHandler(worker_ProgressChanged);
            w.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            w.WorkerReportsProgress      = true;
            w.WorkerSupportsCancellation = false;

            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            DoubleAnimation a = new DoubleAnimation(0.0, 100.0, new Duration(TimeSpan.FromSeconds(1)));

            a.RepeatBehavior = RepeatBehavior.Forever;
            a.AutoReverse    = true;

            RowDefinition r = new RowDefinition();

            outerGrid.RowDefinitions.Add(r);
            r.Height = new GridLength(26);
            ColumnDefinition c1 = new ColumnDefinition();
            ColumnDefinition c2 = new ColumnDefinition();

            c1.Width = new GridLength(170);
            c2.Width = new GridLength(75);
            outerGrid.ColumnDefinitions.Add(c1);
            outerGrid.ColumnDefinitions.Add(c2);

            Label l = new Label();

            l.Content = "Disconnecting...";
            l.Height  = 26;
            Grid.SetRow(l, 0);
            Grid.SetColumn(l, 0);
            outerGrid.Children.Add(l);

            ProgressBar p = new ProgressBar();

            p.Height = 26;
            p.Width  = 75;
            Grid.SetRow(p, outerGrid.RowDefinitions.Count() - 1);
            Grid.SetColumn(p, 1);
            outerGrid.Children.Add(p);

            pbars.Add(w.id, p);
            returnSQL = null;
            Object[] args = { "Disconnect", sql };
            workers.Add(workers.Count(), w);
            w.RunWorkerAsync(args);
        }
Exemple #3
0
        // Copy a job...
        public Submission(string db, string backupdb, Int32Collection jobs, bool move = false)
        {
            InitializeComponent();
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            Title = move ? "Moving..." : "Copying...";

            ColumnDefinition c1 = new ColumnDefinition();
            ColumnDefinition c2 = new ColumnDefinition();

            c1.Width = new GridLength(170);
            c2.Width = new GridLength(75);
            outerGrid.ColumnDefinitions.Add(c1);
            outerGrid.ColumnDefinitions.Add(c2);

            workers.Clear();

            Int32Collection.Enumerator e = jobs.GetEnumerator();
            while (e.MoveNext())
            {
                int jobID = e.Current;

                WindowInteropHelper helper = new WindowInteropHelper(this);
                SubmissionWorker    w      = new SubmissionWorker(helper.Handle, workers.Count());
                w.DoWork                    += new DoWorkEventHandler(worker_DoWork);
                w.ProgressChanged           += new ProgressChangedEventHandler(worker_ProgressChanged);
                w.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
                w.WorkerReportsProgress      = true;
                w.WorkerSupportsCancellation = false;

                RowDefinition r = new RowDefinition();
                outerGrid.RowDefinitions.Add(r);
                r.Height = new GridLength(26);
                Label l = new Label();
                l.Content = (move ? "Moving" : "Copying") + " Job #" + jobID.ToString() + "...";
                l.Height  = 26;
                Grid.SetRow(l, outerGrid.RowDefinitions.Count() - 1);
                Grid.SetColumn(l, 0);
                outerGrid.Children.Add(l);

                ProgressBar p = new ProgressBar();
                p.Height = 26;
                p.Width  = 75;
                Grid.SetRow(p, outerGrid.RowDefinitions.Count() - 1);
                Grid.SetColumn(p, 1);
                outerGrid.Children.Add(p);

                pbars.Add(w.id, p);
                String[] args = { "Copy", db, backupdb, jobID.ToString(), move.ToString() };
                workers.Add(workers.Count(), w);
                w.RunWorkerAsync(args);
            }

            Mouse.OverrideCursor = null;
        }
Exemple #4
0
        // Catchall job submission
        public Submission(string db, string cluster, string locality, int priority, string nodegroup, string executor, string min, string max, string jobTemplate, int jobTimeout, int taskTimeout)
        {
            InitializeComponent();
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
            Title = "Submitting catchall job...";

            ColumnDefinition c1 = new ColumnDefinition();
            ColumnDefinition c2 = new ColumnDefinition();

            c1.Width = new GridLength(170);
            c2.Width = new GridLength(75);
            outerGrid.ColumnDefinitions.Add(c1);
            outerGrid.ColumnDefinitions.Add(c2);

            workers.Clear();

            WindowInteropHelper helper = new WindowInteropHelper(this);
            SubmissionWorker    w      = new SubmissionWorker(helper.Handle, workers.Count());

            w.DoWork                    += new DoWorkEventHandler(worker_DoWork);
            w.ProgressChanged           += new ProgressChangedEventHandler(worker_ProgressChanged);
            w.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            w.WorkerReportsProgress      = true;
            w.WorkerSupportsCancellation = false;

            RowDefinition r = new RowDefinition();

            outerGrid.RowDefinitions.Add(r);
            r.Height = new GridLength(26);
            Label l = new Label();

            l.Content = "Catchall...";
            l.Height  = 26;
            Grid.SetRow(l, outerGrid.RowDefinitions.Count() - 1);
            Grid.SetColumn(l, 0);
            outerGrid.Children.Add(l);

            ProgressBar p = new ProgressBar();

            p.Height = 26;
            p.Width  = 75;
            Grid.SetRow(p, outerGrid.RowDefinitions.Count() - 1);
            Grid.SetColumn(p, 1);
            outerGrid.Children.Add(p);

            pbars.Add(w.id, p);
            Object[] args = { "Catchall", db, cluster, locality, priority, nodegroup, executor, min, max, jobTemplate, jobTimeout, taskTimeout };
            workers.Add(workers.Count(), w);
            w.RunWorkerAsync(args);

            Mouse.OverrideCursor = null;
        }
Exemple #5
0
        private void uploadBinary(string db, string executable)
        {
            haveBinId = false;

            WindowInteropHelper helper = new WindowInteropHelper(this);
            SubmissionWorker    w      = new SubmissionWorker(helper.Handle, workers.Count());

            w.DoWork                    += new DoWorkEventHandler(worker_DoWork);
            w.ProgressChanged           += new ProgressChangedEventHandler(worker_ProgressChanged);
            w.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            w.WorkerReportsProgress      = true;
            w.WorkerSupportsCancellation = false;

            RowDefinition row = new RowDefinition();

            outerGrid.RowDefinitions.Add(row);
            row.Height = new GridLength(26);
            Label l = new Label();

            l.Content = "Upload binary...";
            l.Height  = 26;
            Grid.SetRow(l, outerGrid.RowDefinitions.Count() - 1);
            Grid.SetColumn(l, 0);
            outerGrid.Children.Add(l);

            ProgressBar p = new ProgressBar();

            p.Height = 26;
            p.Width  = 75;
            Grid.SetRow(p, outerGrid.RowDefinitions.Count() - 1);
            Grid.SetColumn(p, 1);
            outerGrid.Children.Add(p);

            DoubleAnimation a = new DoubleAnimation(0.0, 100.0, new Duration(TimeSpan.FromSeconds(1)));

            a.RepeatBehavior = RepeatBehavior.Forever;
            a.AutoReverse    = true;
            p.BeginAnimation(System.Windows.Controls.ProgressBar.ValueProperty, a);

            pbars.Add(w.id, p);
            Object[] args = { "Upload", db, executable };
            workers.Add(w.id, w);
            w.RunWorkerAsync(args);
        }
Exemple #6
0
        private void submit(string db, string categories, string sharedDir, string memout, string timeout, string executor,
                            string parameters, string cluster, string nodegroup, string locality, string limitsMin, string limitsMax,
                            string username, int priority, string extension, string note,
                            string jobTemplate,
                            int jobTimeout, int taskTimeout)
        {
            string[] cats = categories.Split(',');
            foreach (string category in cats)
            {
                WindowInteropHelper helper = new WindowInteropHelper(this);
                SubmissionWorker    w      = new SubmissionWorker(helper.Handle, workers.Count());
                w.DoWork                    += new DoWorkEventHandler(worker_DoWork);
                w.ProgressChanged           += new ProgressChangedEventHandler(worker_ProgressChanged);
                w.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
                w.WorkerReportsProgress      = true;
                w.WorkerSupportsCancellation = false;

                RowDefinition r = new RowDefinition();
                outerGrid.RowDefinitions.Add(r);
                r.Height = new GridLength(26);
                Label l = new Label();
                l.Content = category.Replace("_", "__");
                l.Height  = 26;
                Grid.SetRow(l, outerGrid.RowDefinitions.Count() - 1);
                Grid.SetColumn(l, 0);
                outerGrid.Children.Add(l);

                ProgressBar p = new ProgressBar();
                p.Height = 26;
                p.Width  = 75;
                Grid.SetRow(p, outerGrid.RowDefinitions.Count() - 1);
                Grid.SetColumn(p, 1);
                outerGrid.Children.Add(p);

                pbars.Add(w.id, p);
                Object[] args = { "Submit",    db,         category,  sharedDir, memout,    timeout,   executor,
                                  parameters,  cluster,    nodegroup, locality,  limitsMin, limitsMax, username,priority, extension, note,
                                  jobTemplate, jobTimeout, taskTimeout };

                workers.Add(workers.Count(), w);
                w.RunWorkerAsync(args);
            }
        }
Exemple #7
0
        public void Run(string[] args)
        {
            SubmissionWorker w = new SubmissionWorker(IntPtr.Zero, 0);

            w.ProgressChanged           += new ProgressChangedEventHandler(worker_ProgressChanged);
            w.WorkerReportsProgress      = true;
            w.WorkerSupportsCancellation = false;

            Configuration config;

            if (args.Count() == 1)
            {
                if (args[0] == "-h" || args[0] == "--help" || args[0] == "/?")
                {
                    Console.WriteLine("Usage: ClusterSubmit [config-file]");
                    return;
                }
                else
                {
                    config = new Configuration(args[0]);
                }
            }
            else
            {
                config = new Configuration("config.xml");
            }


            string executable = findBinary(config.z3_drop_dir, config.z3_release_dir, config.z3_exe);

            if (executable == "")
            {
                Console.WriteLine(now() + ": Z3 not found.");
                return;
            }
            else if (File.Exists("last_binary"))
            {
                FileStream   lf   = File.OpenRead("last_binary");
                StreamReader sr   = new StreamReader(lf);
                long         last = Convert.ToInt64(sr.ReadLine());
                if (last >= File.GetLastWriteTime(executable).ToFileTimeUtc())
                {
                    Console.WriteLine(now() + ": No new binary.");
                    return;
                }
                sr.Close();
                lf.Close();
            }

            bool haveBinId = false;
            int  binId     = 0;

            try
            {
                string bestCluster = SubmissionWorker.FindCluster(config.cluster, config.alternativeClusters);
                Console.WriteLine(now() + ": Submitting job to " + bestCluster + " with the following binary: " + executable);

                w.UploadBinary(config.db, executable, ref haveBinId, ref binId);

                string sExecutor = "";
                int    jid       =
                    w.SetupExperiment(config.db, config.category, config.sharedDir, config.memout, config.timeout, config.executor, config.parameters,
                                      bestCluster, config.nodegroup, config.locality, config.minResources, config.maxResources, config.username, config.priority, config.extension, config.note, config.jobTemplate, config.jobTimeout, config.taskTimeout, ref haveBinId, ref binId, ref sExecutor);
                w.SubmitHPCJob(config.db, true, jid, config.cluster, config.nodegroup, config.priority, config.locality, config.minResources, config.maxResources, config.sharedDir, sExecutor, config.jobTemplate, config.jobTimeout, config.taskTimeout);

                saveBinaryDate(executable);

                uint retries = 0;
                if (File.Exists(config.fuzzer_target))
                {
retry:
                    if (File.GetLastWriteTime(executable) > File.GetLastWriteTime(config.fuzzer_target))
                    {
                        try
                        {
                            File.Copy(executable, config.fuzzer_target, true);
                        }
                        catch (Exception ex)
                        {
                            retries++;
                            if (retries < config.fuzzer_max_retries)
                            {
                                goto retry;
                            }
                            else
                            {
                                throw ex;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(now() + ": Exception caught: " + ex.Message);
            }
        }
Exemple #8
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            SubmissionWorker w = (SubmissionWorker)sender;

            Object[] args = (Object[])e.Argument;

            string cmd = (string)args[0];

            try
            {
                if (cmd == "Connect")
                {
                    returnSQL = w.Connect((string)args[1]);
                }
                else if (cmd == "Disconnect")
                {
                    w.Disconnect((SqlConnection)args[1]);
                }
                else if (cmd == "Upload")
                {
                    w.UploadBinary((string)args[1], (string)args[2], ref haveBinId, ref binId);
                }
                else if (cmd == "Submit")
                {
                    string sExecutor = "";
                    int    jobid     =
                        w.SetupExperiment((string)args[1], (string)args[2], (string)args[3],
                                          (string)args[4], (string)args[5], (string)args[6], (string)args[7],
                                          (string)args[8], (string)args[9], (string)args[10], (string)args[11], (string)args[12],
                                          (string)args[13], (int)args[14], (string)args[15], (string)args[16],
                                          (string)args[17], (int)args[18], (int)args[19],
                                          ref haveBinId, ref binId, ref sExecutor);
                    w.SubmitHPCJob((string)args[1], true, jobid, (string)args[8], (string)args[9], (int)args[14],
                                   (string)args[10], (string)args[11], (string)args[12],
                                   (string)args[3], sExecutor, (string)args[17], (int)args[18], (int)args[19]);

                    // e.Result = "1 experiment with " + jobs + " jobs submitted.";
                }
                else if (cmd == "Copy")
                {
                    w.Copy((string)args[1], (string)args[2], (string)args[3], ((string)args[4] == "True"));
                }
                else if (cmd == "Reinforce")
                {
                    w.Reinforce((string)args[1], (int)args[2], (string)args[3], (int)args[4], (int)args[5], (string)args[6], (int)args[7], (int)args[8]);
                }
                else if (cmd == "Recovery")
                {
                    w.SubmitHPCRecoveryJob((string)args[1], (int)args[2], (string)args[3],
                                           (int)args[4], (int)args[5], (string)args[6], (string)args[7],
                                           (int)args[8], (int)args[9]);
                }
                else if (cmd == "Catchall")
                {
                    w.SubmitCatchall((string)args[1], (string)args[2], (string)args[3], (int)args[4],
                                     (string)args[5], (string)args[6], (string)args[7], (string)args[8],
                                     (string)args[9], (int)args[10], (int)args[11]);
                }
                else
                {
                    throw new Exception("Unknown submission operation: " + cmd);
                }
            }
            catch (Exception ex)
            {
                lastError = ex;
            }
        }