Пример #1
0
        private void cmdSubmit_Click(object sender, EventArgs e)
        {
            ArrayList prins = ucSectionExpl.Principals;
            ArrayList tests = GetTests();
            string warnings="";
            int asstID = Convert.ToInt32(HttpContext.Current.Request.Params["AsstID"]);
            AutoJobs jobs = new AutoJobs(Globals.CurrentIdentity);
            Principals aprins = new Principals(Globals.CurrentIdentity);
            foreach (int prin in prins) {
                foreach (int evalid in tests) {
                    try {

                        Components.Submission sub = aprins.GetLatestSubmission(prin, asstID);
                        if (sub == null) {
                            warnings += aprins.GetInfo(prin).Name + " ";
                            break;
                        }
                        else
                            jobs.Create(txtName.Text, evalid, sub.ID);

                    } catch (DataAccessException er) {
                        PageError(er.Message);
                        return;
                    }
                }
            }

            PageError("Job: " + txtName.Text + " created successfully. Refer to the " +
                      "job status page to monitor its progress through the testing centers. Users/Groups: " +
                      warnings + " do not have any submissions and tests will not be run on them.");
        }
Пример #2
0
        private void dgTests_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            Label lblSub, lblEval, lblQueue;
            System.Web.UI.WebControls.Image imgStatus;
            if (null != (lblSub = (Label) e.Item.FindControl("lblSub"))) {
                lblEval = (Label) e.Item.FindControl("lblEval");
                lblQueue = (Label) e.Item.FindControl("lblQueue");
                imgStatus = (System.Web.UI.WebControls.Image) e.Item.FindControl("imgStatus");

                AutoJobTest test = (AutoJobTest) e.Item.DataItem;
                lblEval.Text = test.AutoEval.Name;

                Components.Submission sub =
                    new Submissions(Globals.CurrentIdentity).GetInfo(test.SubmissionID);
                lblSub.Text = new FileSystem(Globals.CurrentIdentity).GetFile(sub.LocationID).Alias;

                if (test.Status == AutoJobTest.DONE)
                    imgStatus.ImageUrl = "../../attributes/subgrade.gif";
                else
                    imgStatus.ImageUrl = "../../attributes/sub.gif";

                AutoJobs autojobda = new AutoJobs(Globals.CurrentIdentity);
                lblQueue.Text = String.Format("{0} out of {1}",
                    autojobda.GetQueuePosition(test), autojobda.GetAllTests().Count);
            }
        }
Пример #3
0
        private void DoDelete(int subID, int locid)
        {
            FileSystem fs = new FileSystem(m_ident);

            //Take results
            Results resultda = new Results(m_ident);

            Result.ResultList ress = GetResults(subID);
            foreach (Result res in ress)
            {
                resultda.Delete(res.ID);
            }

            //Take any tests queued
            AutoJobs jobda = new AutoJobs(m_ident);

            AutoJobTest.AutoJobTestList tests = jobda.GetSubTests(subID);
            foreach (AutoJobTest test in tests)
            {
                jobda.FinishTest(test);
            }

            //Take the submission record
            m_dp.DeleteSubmission(subID);

            //Take the files
            CFile subdir = fs.GetFile(locid);

            if (subdir != null)
            {
                fs.DeleteFile(subdir);
            }
        }
Пример #4
0
        private void BindData()
        {
            AutoJobTest.AutoJobTestList tests =
                new AutoJobs(Globals.CurrentIdentity).GetTests(GetJobID());

            dgTests.DataSource = tests;
            dgTests.DataBind();
        }
Пример #5
0
        private void BindData()
        {
            AutoJob.AutoJobList jobs =
                new AutoJobs(Globals.CurrentIdentity).GetUserAsstJobs(GetAsstID());

            dgJobs.DataSource = jobs;
            dgJobs.DataBind();
        }
Пример #6
0
        private void BindData()
        {
            AutoJobs acjobs = new AutoJobs(Globals.CurrentIdentity);

            AutoJob.AutoJobList jobs = acjobs.GetAll();

            dgActive.DataSource = jobs;
            dgActive.DataBind();
        }
Пример #7
0
        private void QueueSubmitTests(Components.Submission sub)
        {
            int    asstID = sub.AsstID;
            string strlog = "";

            Evaluation.EvaluationList tests = new Assignments(m_ident).GetSubmitAutoEvals(asstID);
            if (tests.Count == 0)
            {
                return;
            }

            //Queue up pretests
            AutoJobs jobda = new AutoJobs(m_ident);
            AutoJob  job   = jobda.Create(m_ident.Name + " submission", asstID);

            foreach (Evaluation eval in tests)
            {
                jobda.CreateTest(job.ID, sub.ID, eval.ID, true);
                strlog += eval.Name + " ";
            }

            //Log queueing
            Log("Pretests queued: " + strlog, sub.ID);
        }
Пример #8
0
        private void QueueSubmitTests(Components.Submission sub)
        {
            int asstID = sub.AsstID;
            string strlog="";
            Evaluation.EvaluationList tests = new Assignments(m_ident).GetSubmitAutoEvals(asstID);
            if (tests.Count == 0) return;

            //Queue up pretests
            AutoJobs jobda = new AutoJobs(m_ident);
            AutoJob job = jobda.Create(m_ident.Name + " submission", asstID);
            foreach (Evaluation eval in tests) {
                jobda.CreateTest(job.ID, sub.ID, eval.ID, true);
                strlog += eval.Name + " ";
            }

            //Log queueing
            Log("Pretests queued: " + strlog, sub.ID);
        }
Пример #9
0
        private void DoDelete(int subID, int locid)
        {
            FileSystem fs = new FileSystem(m_ident);

            //Take results
            Results resultda = new Results(m_ident);
            Result.ResultList ress = GetResults(subID);
            foreach (Result res in ress)
                resultda.Delete(res.ID);

            //Take any tests queued
            AutoJobs jobda = new AutoJobs(m_ident);
            AutoJobTest.AutoJobTestList tests = jobda.GetSubTests(subID);
            foreach (AutoJobTest test in tests)
                jobda.FinishTest(test);

            //Take the submission record
            m_dp.DeleteSubmission(subID);

            //Take the files
            CFile subdir = fs.GetFile(locid);
            if (subdir != null)
                fs.DeleteFile(subdir);
        }
Пример #10
0
        private void lnkRunTest_Click(object sender, EventArgs e)
        {
            AutoJobs ajobda = new AutoJobs(Globals.CurrentIdentity);

            Components.Submission sub =
                new Submissions(Globals.CurrentIdentity).GetInfo(GetSubID());

            Evaluation eval =
                new Evaluations(Globals.CurrentIdentity).GetInfo(Convert.ToInt32(lblEvalID.Text));
            string name = new FileSystem(Globals.CurrentIdentity).GetFile(sub.LocationID).Alias +
                " (" + eval.Name + ")";
            try {
                AutoJob job =
                    ajobda.Create(name, sub.AsstID);
                ajobda.CreateTest(job.ID, sub.ID, eval.ID, false);
            } catch (DataAccessException er) {
                PageRunError(er.Message);
                return;
            }

            PageRunError("Automatic job created successfully!");
        }
Пример #11
0
        private void cmdSubmit_Click(object sender, EventArgs e)
        {
            ArrayList prins = GetPrincipals();
            ArrayList tests = GetTests();
            AutoJobs jobs = new AutoJobs(Globals.CurrentIdentity);
            Principals aprins = new Principals(Globals.CurrentIdentity);

            //Check for nothing
            if (tests.Count == 0 || prins.Count == 0) {
                PageAutoError("Must select at least one user and one test to create an auto job");
                return;
            }

            AutoJob job = jobs.Create(txtName.Text, GetAsstID());
            foreach (int prin in prins) {
                foreach (int evalid in tests) {
                    try {
                        Components.Submission sub =
                            aprins.GetLatestSubmission(prin, GetAsstID());
                        if (sub != null)
                            jobs.CreateTest(job.ID, sub.ID, evalid, false);
                    } catch (DataAccessException er) {
                        PageAutoError(er.Message);
                        return;
                    }
                }
            }

            mpViews.SelectedIndex = 1;
        }
Пример #12
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));
            }
        }
Пример #13
0
        /// <summary>
        /// Delete the assignment
        /// </summary>
        public bool Delete(int asstID)
        {
            FileSystem fs = new FileSystem(m_ident);
            Submissions subda = new Submissions(m_ident);
            Evaluations evalda = new Evaluations(m_ident);
            Results resultda = new Results(m_ident);
            Groups groupda = new Groups(m_ident);
            AutoJobs jobda = new AutoJobs(m_ident);

            Assignment asst = GetInfo(asstID);

            //Check permission
            Authorize(asst.CourseID, "delete", asstID, null);

            //Take auto jobs
            IProviderTransaction tran = m_dp.BeginTransaction();
            AutoJob.AutoJobList jobs = GetAutoJobs(asstID, tran);
            foreach (AutoJob job in jobs)
                jobda.Finish(job.ID, tran);
            m_dp.CommitTransaction(tran);

            //Take submissions and results
            Components.Submission.SubmissionList allsubs = GetSubmissions(asstID);
            foreach (Components.Submission sub in allsubs)
                subda.Delete(sub.ID);

            //Take rubric
            Rubric rub = GetRubric(asstID);
            new Rubrics(m_ident).Delete(rub.ID);

            //Take evaluations
            Evaluation.EvaluationList allevals = GetEvals(asstID);
            foreach (Evaluation eval in allevals)
                evalda.Delete(eval.ID);

            //Take groups
            Group.GroupList groups = GetGroups(asstID);
            foreach (Group group in groups)
                groupda.Delete(group.PrincipalID, asstID);

            //Take assignment
            m_dp.DeleteAssignment(asstID);

            //Take content
            CFile content = fs.GetFile(asst.ContentID);
            fs.DeleteFile(content);

            //Log
            Log("Deleted assignment: " + asst.Description, asst.ID);

            return true;
        }
Пример #14
0
        private string GetProgress(AutoJob job)
        {
            AutoJobTest.AutoJobTestList tests =
                new AutoJobs(Globals.CurrentIdentity).GetTests(job.ID);
            int done=0;
            foreach (AutoJobTest test in tests)
                if (test.Status == AutoJobTest.DONE)
                    done++;

            return String.Format("{0}/{1}", done, tests.Count);
        }
Пример #15
0
        /// <summary>
        /// Delete the assignment
        /// </summary>
        public bool Delete(int asstID)
        {
            FileSystem  fs       = new FileSystem(m_ident);
            Submissions subda    = new Submissions(m_ident);
            Evaluations evalda   = new Evaluations(m_ident);
            Results     resultda = new Results(m_ident);
            Groups      groupda  = new Groups(m_ident);
            AutoJobs    jobda    = new AutoJobs(m_ident);

            Assignment asst = GetInfo(asstID);

            //Check permission
            Authorize(asst.CourseID, "delete", asstID, null);

            //Take auto jobs
            IProviderTransaction tran = m_dp.BeginTransaction();

            AutoJob.AutoJobList jobs = GetAutoJobs(asstID, tran);
            foreach (AutoJob job in jobs)
            {
                jobda.Finish(job.ID, tran);
            }
            m_dp.CommitTransaction(tran);

            //Take submissions and results
            Components.Submission.SubmissionList allsubs = GetSubmissions(asstID);
            foreach (Components.Submission sub in allsubs)
            {
                subda.Delete(sub.ID);
            }

            //Take rubric
            Rubric rub = GetRubric(asstID);

            new Rubrics(m_ident).Delete(rub.ID);

            //Take evaluations
            Evaluation.EvaluationList allevals = GetEvals(asstID);
            foreach (Evaluation eval in allevals)
            {
                evalda.Delete(eval.ID);
            }

            //Take groups
            Group.GroupList groups = GetGroups(asstID);
            foreach (Group group in groups)
            {
                groupda.Delete(group.PrincipalID, asstID);
            }

            //Take assignment
            m_dp.DeleteAssignment(asstID);

            //Take content
            CFile content = fs.GetFile(asst.ContentID);

            fs.DeleteFile(content);

            //Log
            Log("Deleted assignment: " + asst.Description, asst.ID);

            return(true);
        }
Пример #16
0
        private void LoadAutoSysNode(TreeNode par, int asstID)
        {
            AutoJob.AutoJobList jobs =
                new AutoJobs(Globals.CurrentIdentity).GetUserAsstJobs(asstID);

            par.Nodes.Clear();
            foreach (AutoJob job in jobs)
                AddAutoJobNode(par.Nodes, job);
        }