Ejemplo n.º 1
0
        private void lnkDefunct_Click(object sender, EventArgs e)
        {
            Submissions subda = new Submissions(Globals.CurrentIdentity);

            Components.Submission sub = subda.GetInfo(GetSubID());

            //Change status
            if (sub.Status != Components.Submission.DEFUNCT)
            {
                sub.Status = Components.Submission.DEFUNCT;
            }
            else
            {
                sub.Status = Components.Submission.UNGRADED;
            }

            try {
                subda.Update(sub, new EmptySource());
            } catch (DataAccessException er) {
                PageError(er.Message);
            } catch (FileOperationException er) {
                PageError(er.Message);
            }

            BindData();
            Refresh(this, new RefreshEventArgs("", true, false));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Main worker thread for the testing center
        /// </summary>
        public void TestWorker()
        {
            AutoJobTest job;
            bool        bsuc;
            Evaluations evals   = new Evaluations(m_ident);
            AutoJobs    jobs    = new AutoJobs(m_ident);
            ZoneService testsvc = new ZoneService("auto", m_ident, m_logger);
            ZoneService stusvc  = new ZoneService("stu", m_ident, m_logger);
            Submissions subs    = new Submissions(m_ident);

            while (!m_shutdown)
            {
                //Get job
                try {
                    job = jobs.Claim(m_ipaddress, m_desc);
                    if (job != null)
                    {
                        m_status = Status.RUNNING;

                        Submission sub = subs.GetInfo(job.SubmissionID);
                        m_logger.Log(String.Format("Claimed job: JOB: {0} EVAL: {1} SUB: {2}",
                                                   job.JobName, job.AutoEval.Name, new Principals(m_ident).GetInfo(sub.PrincipalID).Name));

                        m_logger.Log("Synchronizing eval and student zones");
                        //Sync test zone
                        Zone tzone = testsvc.Synchronize(job.AutoEval);

                        //Sync stu zone
                        Zone szone = stusvc.Synchronize(sub);

                        //Copy stu zone into test zone
                        testsvc.CopyZone(tzone, szone);

                        //Create dep graph and run deps
                        m_logger.Log("Beginning dependency running");
                        Evaluations.DependencyGraph dg =
                            new Evaluations.DependencyGraph(job.AutoEval, m_ident);
                        string faildep, xmloutput = "";
                        if (null != (faildep = RunDependencies(tzone, testsvc, dg)))
                        {
                            xmloutput = FormErrorXml(AutoResult.DEPFAIL,
                                                     "Test unable to run, dependency: " +
                                                     faildep + " failed to complete successfully!",
                                                     job.AutoEval.Points);
                            m_logger.Log("Dependency fail (" + faildep + "), not running main test",
                                         TestLogger.LogType.WARNING);
                        }
                        else
                        {
                            //Run test and gather result
                            m_logger.Log("Starting run of test");
                            if (job.AutoEval.IsBuild)
                            {
                                xmloutput = RunBuildTest(tzone, job.AutoEval, out bsuc);
                            }
                            else
                            {
                                xmloutput = RunTest(tzone, job.AutoEval);
                            }
                        }

                        //Post result
                        xmloutput = Globals.PurifyZeroes(xmloutput);
                        if (!PostResult(job, xmloutput))
                        {
                            m_logger.Log("Error logging result", TestLogger.LogType.ERROR);
                        }
                        else
                        {
                            m_logger.Log("Test completed, result stored");
                        }

                        //Clear the job out
                        jobs.FinishTest(job);
                    }
                } catch (Exception er) {
                    m_logger.Log("Unexpected and fatal error during testing: MESSAGE: " + er.Message, TestLogger.LogType.ERROR);
                }

                m_status = Status.QUEUED;
                Thread.Sleep(TimeSpan.FromSeconds(5));
            }
        }