/// <summary> /// Handler for SubmitAreaCommand. It will try to submit computed area. /// </summary> public async Task SubmitAreaAsync() { if (SubmissionInProgress) { return; } SubmissionResult = SubmissionResult.None; SubmissionInProgress = true; SubmitAreaCommand.RaiseCanExecuteChanged(); await Task.Run(() => { try { _SubmissionService.SubmitTotalArea(TotalArea); SubmissionResult = SubmissionResult.Success; } catch (Exception) { SubmissionResult = SubmissionResult.Failure; } SubmissionInProgress = false; SubmitAreaCommand.RaiseCanExecuteChanged(); }); }
public EvaluationResultEventArgs(Problem problem, ProblemTest test, SubmissionResult result, Status status) { Problem = problem; Test = test; Result = result; Status = status; }
public async Task SetResult(SubmissionResult value) { if (value == null) { _submission.AcceptedCase = null; _submission.HasIssue = false; _submission.Issues = ""; _submission.TotalCase = null; _submission.MaximumTime = null; _submission.SampleResults = ""; _submission.TestResults = ""; _submission.State = JudgeState.Pending; _submission.MaximumMemory = null; } else { _submission.AcceptedCase = value.AcceptedCase; _submission.HasIssue = value.HasIssue; _submission.Issues = JsonConvert.SerializeObject(value.Issues); _submission.TotalCase = value.TotalCase; _submission.MaximumTime = value.MaximumTime?.Ticks; _submission.SampleResults = JsonConvert.SerializeObject(value.Samples); _submission.TestResults = JsonConvert.SerializeObject(value.Tests); _submission.State = value.State; _submission.MaximumMemory = value.MaximumMemory; } await _context.SaveChangesAsync(); }
public void CheckSolution() { SubmissionResult s = InternalCheckSolution(); BaseDb db = DbFactory.ConstructDatabase(); db.AddResult(s, int.Parse(subm)); db.Close(); }
public void TestSubmissionsResponseConversion() { string jsonExpected = TestUtil.Read("submission_response.json"); SubmissionResult model = JsonConvert.DeserializeObject <SubmissionResult>(jsonExpected); string jsonActual = JsonConvert.SerializeObject(model); TestUtil.AssertJsonEqual(jsonExpected, jsonActual); }
public void SubmissionResult_ShouldReturnResult() { var result = new SubmissionResult { SubmissionID = _testData.GetSubmissionId() }.Invoke(); result.Value <int>("submission_id").Should().BeGreaterThan(0); result["results"].Should().BeOfType(typeof(JObject)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool invert = parameter != null; SubmissionResult result = value as SubmissionResult? ?? SubmissionResult.None; return(result == SubmissionResult.Success ? invert ? Visibility.Collapsed : Visibility.Visible : result == SubmissionResult.Failure ? invert ? Visibility.Visible : Visibility.Collapsed : Visibility.Collapsed); }
/// <summary> /// Gets a specific certificate signing request. /// </summary> /// <param name="id">The id of the certificate signing request to be retrieved.</param> /// <returns>Returns the certificate signing request.</returns> public SubmissionResult GetCsr(string rawId) { int id = Int32.Parse(rawId); var submission = this.certTool.GetRequestStatus(id); var result = new SubmissionResult(submission.Message, submission.RequestId, (SubmissionStatus)submission.Outcome, submission.AuthorityResponse); return(result); }
public object Get(object id, object versionId) { int cid = Int32.Parse((string)id); var submission = this.m_certTool.GetRequestStatus(cid); var result = new SubmissionResult(submission.Message, submission.RequestId, (SubmissionStatus)submission.Outcome, submission.AuthorityResponse); return(result); }
public SubmissionResult SubmitException(Exception e, string description, string itnUserName, string itnPassword, int buildNumber, IWebProxy proxy) { SubmissionResult res = null; try { bool checkFailed = false; TrackerProxy submitter = new TrackerProxy(); submitter.Proxy = proxy; OnSubmitProgress("Submitting..."); XmlRpcAsyncResult ar = (XmlRpcAsyncResult)submitter.BeginPostException(e.ToString(), e.Message, e.StackTrace, description, itnUserName, itnPassword, "mypal", buildNumber, null, null); int sleepCount = 0; while (!ar.IsCompleted) { Application.DoEvents(); Thread.Sleep(250); sleepCount++; if (sleepCount == 60) { // 15 seconds checkFailed = true; ar.Abort(); break; } } if (!checkFailed) { try { RPCSubmissionResult rsr = submitter.EndPostException(ar); OnSubmitProgress("Submitted"); XmlDocument doc = new XmlDocument(); doc.LoadXml(rsr.RequestDescription); res = new SubmissionResult(rsr.ThreadID, rsr.IsUpdated, doc); } catch (XmlRpcFaultException ex) { Trace.WriteLine(ex.FaultString); OnSubmitProgress("Failed"); } } else { OnSubmitProgress("Failed"); } } catch (XmlRpcFaultException ex) { Trace.WriteLine(ex.FaultString); OnSubmitProgress("Failed"); } return(res); }
/// <summary> /// 提交3GX数据到主数据库中 /// </summary> /// <param name="info"></param> /// <returns></returns> public SubmissionResult Submit(SubmissionInfo info) { result = new SubmissionResult(); ListsubErr = new List<SubmissionError>(); xmldata = Xml2Str(info.GGGXData);//得到传入的3GX数据 option = Enum.GetName(typeof(SubmissionOption), info.Option);//得到传入的枚举值 List<GeoFeature> ftList = ConvertFT.ConvertToFTListByXML(xmldata);//将3GX文件转换为对象集合 if (ftList != null) Save3GX(ftList, option);//保存数据 return result; }
public object Obsolete(object key) { int id = Int32.Parse(key.ToString()); this.m_certTool.DenyRequest(id); var status = this.m_certTool.GetRequestStatus(id); var result = new SubmissionResult(status.Message, status.RequestId, (SubmissionStatus)status.Outcome, status.AuthorityResponse); result.Certificate = null; return(result); }
public SubmissionResult RejectCsr(string rawId, OpenIZ.Core.Model.AMI.Security.RevokeReason reason) { int id = Int32.Parse(rawId); this.certTool.DenyRequest(id); var status = this.certTool.GetRequestStatus(id); var result = new SubmissionResult(status.Message, status.RequestId, (SubmissionStatus)status.Outcome, status.AuthorityResponse); result.Certificate = null; return(result); }
public object Update(object data) { // Data var submissionRequest = data as SubmissionResult; this.m_certTool.Approve(submissionRequest.RequestId); var submission = this.m_certTool.GetRequestStatus(submissionRequest.RequestId); var result = new SubmissionResult(submission.Message, submission.RequestId, (SubmissionStatus)submission.Outcome, submission.AuthorityResponse); result.Certificate = null; return(result); }
public async Task <ActionResult <SubmissionResult> > GetResult(string id) { SubmissionResult res = await(await _workspace.Submissions.Get(id))?.GetResult(); if (res != null) { return(Ok(res)); } else { return(NotFound()); } }
private void Page_Init(object sender, EventArgs e) { noSuchProb.Visible = false; if (!Page.IsPostBack) { BaseDb db = DbFactory.ConstructDatabase(); if (!BaseDb.IsJudge(Page.User)) { userTd.Visible = false; } else { userDropDownList.Items.Add(new ListItem("--Ыўсющ--", "0")); foreach (User u in db.GetUsers()) { userDropDownList.Items.Add(new ListItem(u.Fullname, db.GetUid(u.Username).ToString())); } } snameDropDownList.Items.Add(new ListItem("--Ыўсрџ--", "ALL")); for (char c = 'A'; c <= 'Z'; c++) { snameDropDownList.Items.Add(new ListItem(c.ToString(), c.ToString())); } int[] old_tids = db.GetOldTids(); int[] now_tids = db.GetNowTids(); Contest t = null; for (int i = 0; i < old_tids.Length; i++) { t = db.GetContest(old_tids[i]); contestDropDownList.Items.Add(new ListItem(t.Name, old_tids[i].ToString())); } for (int i = 0; i < now_tids.Length; i++) { t = db.GetContest(now_tids[i]); contestDropDownList.Items.Add(new ListItem(t.Name, now_tids[i].ToString())); } resultDropDownList.Items.Add(new ListItem("--Ыўсющ--", "ALL")); foreach (Result r in Enum.GetValues(typeof(Result))) { SubmissionResult res = new SubmissionResult(r); resultDropDownList.Items.Add(new ListItem(res.ToString(), r.ToString())); } userDropDownList.SelectedIndex = resultDropDownList.SelectedIndex = contestDropDownList.SelectedIndex = snameDropDownList.SelectedIndex = 0; } }
public async Task <SubmissionResult> IsProformaSubmitted(int mstId) { SubmissionResult submissionResult = new SubmissionResult(); var proMst = await _nmsDataContext.ProformaInvoiceMsts.FirstOrDefaultAsync(x => x.Id == mstId); if (proMst.Confirmation == true && proMst.SubmissionDate != null) { submissionResult.IsSubmitted = true; } else { submissionResult.IsSubmitted = false; } return(submissionResult); }
public SubmissionResult SubmitCsr(SubmissionRequest s) { var submission = this.certTool.SubmitRequest(s.CmcRequest, s.AdminContactName, s.AdminAddress); var result = new SubmissionResult(submission.Message, submission.RequestId, (SubmissionStatus)submission.Outcome, submission.AuthorityResponse); if (this.configuration.CaConfiguration.AutoApprove) { return(this.AcceptCsr(result.RequestId.ToString())); } else { return(result); } }
public async Task <ActionResult> SetResult(string id, [FromBody] SubmissionResult value) { ISubmissionProvider res = await _workspace.Submissions.Get(id); if (res != null) { await res.SetResult(value); return(Accepted()); } else { return(NotFound()); } }
public SubmissionResult SubmitApplication(CreditCardApplication application) { var sr = new SubmissionResult {ValidationErrors = _validator.Validate(application)}; var isValidApplication = !sr.ValidationErrors.Any(); if (!isValidApplication) { return sr; } sr.ReferenceNumber = _scorer.ScoreApplication(application); return sr; }
public object Create(object data, bool updateIfExists) { var s = data as SubmissionRequest; var submission = this.m_certTool.SubmitRequest(s.CmcRequest, s.AdminContactName, s.AdminAddress); var result = new SubmissionResult(submission.Message, submission.RequestId, (SubmissionStatus)submission.Outcome, submission.AuthorityResponse); if (this.configuration.CaConfiguration.AutoApprove) { return(this.Update(result)); } else { return(result); } }
public void SubmitReview_ShouldReturnResult() { var submissionId = _testData.GetSubmissionId(); var submissionResult = new SubmissionResult { SubmissionID = submissionId }.Invoke(); var changes = (JObject)submissionResult["results"]["document"]["results"]; var result = new SubmitReview { SubmissionID = submissionId, Changes = new InArgument <JObject>(_ => changes), }.Invoke(); result.Should().NotBeNull(); result.Value <int>("review_id").Should().BeGreaterThan(0); result.Value <int>("submission_id").Should().BeGreaterThan(0); }
public SubmissionResult SubmitApplication(CreditCardApplication application) { var sr = new SubmissionResult { ValidationErrors = _validator.Validate(application) }; var isValidApplication = !sr.ValidationErrors.Any(); if (!isValidApplication) { return(sr); } sr.ReferenceNumber = _scorer.ScoreApplication(application); return(sr); }
private void _btnSubmit_Click(object sender, System.EventArgs e) { string userName = Core.SettingStore.ReadString("ErrorReport", "UserName"); string password = Core.SettingStore.ReadString("ErrorReport", "Password"); if (userName.Length == 0 || password.Length == 0) { userName = "******"; password = "******"; } SubmissionResult result = null; IExceptionSubmitter submitter = new RPCExceptionSubmitter(); submitter.SubmitProgress += new SubmitProgressEventHandler(OnSubmitProgress); foreach (ListViewItem lvItem in _lvExceptions.SelectedItems) { Exception ex = (Exception)lvItem.Tag; try { result = submitter.SubmitException(ex, _excDescription, userName, password, Assembly.GetExecutingAssembly().GetName().Version.Build, WebProxy.GetDefaultProxy()); } catch (Exception ex1) { MessageBox.Show(this, "Failed to submit exception: " + ex1.Message, Core.ProductFullName); continue; } _backgroundExceptions.Remove(ex); } for (int i = _lvExceptions.SelectedItems.Count - 1; i >= 0; i--) { _lvExceptions.Items.Remove(_lvExceptions.SelectedItems [i]); } if (result != null) { ExceptionReportForm.ShowSubmissionResult(this, result, "OM"); } if (_backgroundExceptions.Count == 0) { DialogResult = DialogResult.OK; } }
protected override SubmissionResult ProcessSubmission() { SubmissionResult submissionResult = new SubmissionResult { ProblemName = submission.ProblemName, Language = submission.Language, Message = "Build succeeded." }; InsertNewCode(submission.Code); submissionResult.Tests = RunTestCases(); submissionResult.Score = CalculateScore(submissionResult.Tests.Count(t => t.Passed), submissionResult.Tests.Count); return(submissionResult); }
static void SubmitCodeToRun() { Response <SubmissionResult> response = DoSubmitCode(); SubmissionResult result = response.Model; Console.WriteLine("Output: " + result.Stdout); if (!String.IsNullOrWhiteSpace(result.Stderr)) { Console.WriteLine("Error: " + result.Stderr); } if (!String.IsNullOrWhiteSpace(result.Message)) { Console.WriteLine("Message: " + result.Message); } if (result.Status != null) { Console.WriteLine("Status: " + result.Status.Description); } }
public void TestGetSubmission() { Response <SubmissionResult> response = DoSubmit(); SubmissionResult result = response.Model; string token = result.Token; Console.WriteLine("Submission token: " + token); GetSubmissionParms parms = new GetSubmissionParms() { Token = token, Fields = new SubmissionField[] { SubmissionField.Token, SubmissionField.Stdout } }; Response <SubmissionResult> submission; submission = Functions.GetSubmission(parms); Console.WriteLine("Get submission: " + submission); }
static void Main(string[] args) { try { // before using the ArgCollection class, let the DigipedeClient grab its args. DigipedeClient client = new DigipedeClient(); args = client.ProcessArguments(args, true); ArgCollection argCollection = ArgCollection.GetInstance(args); // show help, if requested if (argCollection.ExtractOptionalFlag("help")) { Console.WriteLine(""); Console.WriteLine(UsageMessage); Console.WriteLine(HelpMessage); return; } // fail if the DigipedeClient doesn't have the args SpecialFunctions.CheckCondition(client.IsInitialized, "Digipede Client didn't initialize."); string keepTestName = argCollection.ExtractOptional("keepTest", "AlwaysKeep"); string skipRowIndexFileNameOrNull = argCollection.ExtractOptional <string>("skipRowIndexFile", null); string optimizerName = argCollection.ExtractOptional("optimizer", "BrentThenGrid"); argCollection.CheckNoMoreOptions(); int pieceCount = argCollection.ExtractNext <int>("pieceCount"); //int taskPerJobCount = argCollection.ExtractNext<int>("taskPerJobCount"); -- we're not using this -- keep it in case we want to put it back string treeFileName = argCollection.ExtractNext <string>("treeFile"); string predictorFileName = argCollection.ExtractNext <string>("predictorFile"); string targetFileName = argCollection.ExtractNext <string>("targetFile"); string leafDistributionName = argCollection.ExtractNext <string>("leafDistribution"); string nullDataGeneratorName = argCollection.ExtractNext <string>("nullDataGenerator"); string niceName = argCollection.ExtractNext <string>("niceName"); string outputDirectoryName = argCollection.ExtractNext <string>("outputDirectory"); RangeCollection nullIndexRangeCollection = argCollection.ExtractNext <RangeCollection>("nullIndexRange"); SpecialFunctions.CheckCondition(nullIndexRangeCollection.IsBetween(-1, int.MaxValue), "nullIndex must be at least -1"); argCollection.CheckThatEmpty(); Directory.CreateDirectory(outputDirectoryName); // Define a JobTemplate for PhyloD. JobTemplate jobTemplate = CreateJobTemplate(); // Require 32 bit (ensures we use WOW64 on 64-bit machines) since SpecialFunctions.dll built for x86. jobTemplate.Control.UseWow64On64Bit = true; // allow task failures (all but one failure will result in job success) jobTemplate.JobDefaults.MaxFailures = pieceCount - 1; // allow multiple concurrent tasks (one for each core); each isolated in its own process. jobTemplate.Control.Concurrency = ApplicationConcurrency.MultiplePerCore; jobTemplate.Control.ProcessHostingOptions = HostingOptions.ManySingleUse; // create a Job based on that JobTemplate Job job = jobTemplate.NewJob(); // add job-specific data / files FileDefCollection fileDefs = job.FileDefs; // files Utility.GetNamedFileDef(fileDefs, Constants.TreeFileDefName).RemoteName = treeFileName; Utility.GetNamedFileDef(fileDefs, Constants.PredictorFileDefName).RemoteName = predictorFileName; Utility.GetNamedFileDef(fileDefs, Constants.TargetFileDefName).RemoteName = targetFileName; // skipRowIndex file is more complicated because it may not exist, but the JobTemplate requires it. FileDef fileDef = Utility.GetNamedFileDef(fileDefs, Constants.SkipRowIndexFileDefName); if (skipRowIndexFileNameOrNull == null || skipRowIndexFileNameOrNull == "null") { // stream an empty file fileDef.Stream = new MemoryStream(0); } else { // stream the actual file fileDef.LocalName = skipRowIndexFileNameOrNull; } // Create the tasks for the template for (int pieceIndex = 0; pieceIndex < pieceCount; pieceIndex++) { // Create a Task for this piece Task task = job.NewTask(); // Create an InputData object to encapsulate all input data in one place InputData inputData = new InputData(optimizerName, keepTestName, leafDistributionName, nullDataGeneratorName, niceName, outputDirectoryName, pieceIndex, pieceCount, nullIndexRangeCollection.ToString()); // create a Worker for this task task.Worker = new PhyloDWorker(inputData); } // Wire events to catch result data. Note that retrieving data isn't necessary here -- // data can be requested in a server call from another process. job.TaskCompleted += job_TaskCompleted; // Write an event to catch any monitoring errors client.MonitoringError += client_MonitoringError; // submit the job SubmissionResult sr = client.SubmitJob(jobTemplate, job); Console.WriteLine("Submitted job {0} with {1} tasks.", sr.JobId, job.Tasks.Count); // wait for the result JobStatusSummary jss = client.WaitForJobWithStatus(sr.JobId); Console.WriteLine("Job finished with status of {0}", jss.Status); } catch (Exception exception) { Console.WriteLine(""); Console.WriteLine(exception.Message); if (exception.InnerException != null) { Console.WriteLine(exception.InnerException.Message); } Console.WriteLine(""); Console.WriteLine(UsageMessage); throw; } }
public SubmissionResult SubmitChanges() { //Console.WriteLine("BEGIN send sql commands"); SubmissionResult result = new SubmissionResult(); result.HasUpdateCommands = this.m_SqlUpdateCommands.Count > 0; result.HasDeleteFirstCommands = this.m_SqlDeleteFirstCommands.Count > 0; result.HasDeleteCommands = this.m_SqlDeleteCommands.Count > 0; result.HasInsertCommands = this.m_SqlInsertCommands.Count > 0; result.HasInsertLastCommands = this.m_SqlInsertLastCommands.Count > 0; //if (result.HasDeleteCommands || result.HasDeleteFirstCommands) System.Windows.MessageBox.Show("Delete Commands - pause and step"); this.RunSqlCommands(this.m_SqlUpdateCommands); this.RunSqlCommands(this.m_SqlDeleteFirstCommands); this.RunSqlCommands(this.m_SqlDeleteCommands); this.RunSqlCommands(this.m_SqlInsertCommands); this.RunSqlCommands(this.m_SqlInsertLastCommands); //Console.WriteLine("END send sql commands"); return result; }
public SubmissionResult SubmitChanges() { SubmissionResult result = new SubmissionResult(); result.HasUpdateCommands = this.m_SqlUpdateCommands.Count > 0; result.HasDeleteFirstCommands = this.m_SqlDeleteFirstCommands.Count > 0; result.HasDeleteCommands = this.m_SqlDeleteCommands.Count > 0; result.HasInsertCommands = this.m_SqlInsertCommands.Count > 0; result.HasInsertLastCommands = this.m_SqlInsertLastCommands.Count > 0; if (result.HasUpdateCommands || result.HasDeleteFirstCommands || result.HasDeleteCommands || result.HasInsertCommands || result.HasInsertLastCommands) { using (SqlConnection cn = new SqlConnection(this.m_ConnectionString)) { cn.Open(); SqlTransaction trans = cn.BeginTransaction(); try { this.RunSqlCommands(this.m_SqlUpdateCommands, cn, trans); this.RunSqlCommands(this.m_SqlDeleteFirstCommands, cn, trans); this.RunSqlCommands(this.m_SqlDeleteCommands, cn, trans); this.RunSqlCommands(this.m_SqlInsertCommands, cn, trans); this.RunSqlCommands(this.m_SqlInsertLastCommands, cn, trans); trans.Commit(); } catch (Exception ex) //error occurred { trans.Rollback(); cn.Close(); throw(ex); } } } return result; }
private SubmissionResult InternalCheckSolution() { SubmissionResult res = new SubmissionResult(); res.TimeWorked = 0; res.MemoryUsed = 0; res.Info = ""; res.Code = Result.FA; string problem_arg = Path.Combine(Config.ProblemsDirectory, prob); string subm_arg = Path.Combine(Config.SubmissionsDirectory, subm); Process comp = new Process(); comp.StartInfo.UseShellExecute = false; comp.StartInfo.FileName = Config.DfTest; comp.StartInfo.Arguments = "\"" + problem_arg + "\" \"" + subm_arg + "\" " + ext; comp.StartInfo.WorkingDirectory = Path.GetDirectoryName(Config.DfTest); comp.StartInfo.RedirectStandardOutput = true; Updatedb(Result.RU); comp.Start(); string std_output = comp.StandardOutput.ReadToEnd(); if (!comp.WaitForExit(minute * 15)) { res.Info = "Time limit exceeded for solution testing"; return(res); } if (comp.ExitCode != 0) { if (comp.ExitCode == 1) { res.Code = Result.CE; } else { res.Info = "Testing failed"; StreamWriter sw = new StreamWriter(Path.Combine(subm_arg, "error.desc")); sw.Write(std_output); sw.Close(); } return(res); } XmlDocument doc = new XmlDocument(); try { doc.Load(Path.Combine(subm_arg, "log.xml")); } catch (FileNotFoundException) { res.Info = "Dftest didn't create a log file"; return(res); } catch (XmlException) { res.Info = "Dftest created invalid log"; return(res); } float max_time = 0.0F; int max_mem = 0; int test = 0; string last_res = ""; string comment = ""; XmlNodeList list = doc.ChildNodes[1].ChildNodes; foreach (XmlNode n in list) { XmlElement cure = n as XmlElement; if (n == null || n.Name != "test") { res.Info = "Log file has incorrect format"; return(res); } last_res = cure.GetAttribute("result"); float cur_time; int cur_mem; try { cur_time = float.Parse(cure.GetAttribute("time"), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture); cur_mem = int.Parse(cure.GetAttribute("memory")); if (max_time < cur_time) { max_time = cur_time; } if (max_mem < cur_mem) { max_mem = cur_mem; } } catch (ArgumentException) { res.Info = "Log file has incorrect format"; return(res); } comment = cure.InnerText; test++; } if (test == 0) { res.Info = "No test results were found"; return(res); } res.TimeWorked = max_time; res.MemoryUsed = max_mem; res.Info = comment; res.TestNumber = test; switch (last_res) { case "PASSED": res.Code = Result.AC; res.TestNumber = 0; break; case "CTLE": case "RTLE": res.Code = Result.TLE; break; case "RE": res.Code = Result.CRASH; break; default: res.Code = (Result)Enum.Parse(typeof(Result), last_res, true); break; } return(res); }
public static JObject Invoke(this SubmissionResult submissionResultActivity) => submissionResultActivity.Invoke <SubmissionResult, JObject>((a, outArg) => a.Result = outArg);
/// <summary> /// Initializes a new instance of the <see cref="CertificateViewModel"/> class. /// </summary> /// <param name="submissionResult">The submission result.</param> public CertificateViewModel(SubmissionResult submissionResult) { }