Example #1
0
        /// <summary>
        /// Create a auto result.
        /// </summary>
        public bool CreateAuto(int evalID, string grader, int subID, string result)
        {
            //Check permission
            Submissions subac = new Submissions(m_ident);
            Components.Submission sub = subac.GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "createauto", asst.ID, null);

            AutoResult res = new AutoResult();
            res.EvalID = evalID; res.Grader = grader;
            res.SubmissionID = subID; res.XmlResult = result;

            //Clear out all results for this evaluation
            Submission.SubmissionList subs =
                new Principals(m_ident).GetSubmissions(sub.PrincipalID, sub.AsstID);

            //Delete all old results
            foreach (Submission s in subs) {
                Result.ResultList ress = subac.GetResults(s.ID);
                foreach (Result r in ress) {
                    if (r.Type == Result.AUTO_TYPE) {
                        AutoResult ar = r as AutoResult;
                        if (ar.EvalID == evalID)
                            Delete(ar.ID);
                    }
                }
            }

            return m_dp.CreateAutoResult(res);
        }
Example #2
0
        /// <summary>
        /// Create a auto result.
        /// </summary>
        public bool CreateAuto(int evalID, string grader, int subID, string result)
        {
            //Check permission
            Submissions subac = new Submissions(m_ident);

            Components.Submission sub  = subac.GetInfo(subID);
            Assignment            asst = new Assignments(m_ident).GetInfo(sub.AsstID);

            Authorize(asst.CourseID, "createauto", asst.ID, null);

            AutoResult res = new AutoResult();

            res.EvalID       = evalID; res.Grader = grader;
            res.SubmissionID = subID; res.XmlResult = result;

            //Clear out all results for this evaluation
            Submission.SubmissionList subs =
                new Principals(m_ident).GetSubmissions(sub.PrincipalID, sub.AsstID);

            //Delete all old results
            foreach (Submission s in subs)
            {
                Result.ResultList ress = subac.GetResults(s.ID);
                foreach (Result r in ress)
                {
                    if (r.Type == Result.AUTO_TYPE)
                    {
                        AutoResult ar = r as AutoResult;
                        if (ar.EvalID == evalID)
                        {
                            Delete(ar.ID);
                        }
                    }
                }
            }

            return(m_dp.CreateAutoResult(res));
        }
Example #3
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));
        }
Example #4
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));
            }
        }