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."); }
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); } }
private void BindData() { AutoJobTest.AutoJobTestList tests = new AutoJobs(Globals.CurrentIdentity).GetTests(GetJobID()); dgTests.DataSource = tests; dgTests.DataBind(); }
private void BindData() { AutoJob.AutoJobList jobs = new AutoJobs(Globals.CurrentIdentity).GetUserAsstJobs(GetAsstID()); dgJobs.DataSource = jobs; dgJobs.DataBind(); }
private void BindData() { AutoJobs acjobs = new AutoJobs(Globals.CurrentIdentity); AutoJob.AutoJobList jobs = acjobs.GetAll(); dgActive.DataSource = jobs; dgActive.DataBind(); }
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)); }
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!"); }
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; }
/// <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)); } }