private async Task <IEnumerable <Run> > GetJobRunsAsync(DateTimeOffset startOfWindow, DateTimeOffset endOfWindow) { var finishedJobs = new Collection <Run>(); bool hasMoreInformation; var runOffset = 0; do { RunList jobHistory = await _databricksClient.Jobs.RunsList(offset : runOffset); if (jobHistory == null) { break; } foreach (Run jobRun in jobHistory.Runs) { if (jobRun.EndTime != null && jobRun.EndTime > startOfWindow && jobRun.EndTime < endOfWindow) { finishedJobs.Add(jobRun); } else { return(finishedJobs); } } hasMoreInformation = jobHistory.HasMore; runOffset += jobHistory.Runs.Count(); } while (hasMoreInformation); return(finishedJobs); }
/// <summary> /// 检查台子上的数量,先打26号位置的,再打27号位置的 /// </summary> private void CheckNum() { runList = RunList.Stop; //检查先测哪一台 if (frmMain.mMain.AllCars.AllStatueLineStation[25].HaveCar && !Over[0] && ModeSet[0] != null) { runList = RunList.One; NiuJuSet[0] = HeiFeiMideaDll.cNiuJu.Read(false, true, ModeSet[0].NiuJuIDTwo, frmMain.mMain.AllDataBase.WriteData); } else if (frmMain.mMain.AllCars.AllStatueLineStation[26].HaveCar && Over[1] && ModeSet[1] != null) { runList = RunList.Two; NiuJuSet[1] = HeiFeiMideaDll.cNiuJu.Read(false, true, ModeSet[1].NiuJuIDTwo, frmMain.mMain.AllDataBase.WriteData); } //发送程序号 Dictionary <string, string> parm = new Dictionary <string, string>(); //parm.Add("Start", "774"); //parm.Add("End", "774"); //parm.Add("Block", "100"); //ushort[] sendValue = new ushort[1]; switch (runList) { case RunList.Stop: return; case RunList.One: Start[0] = true; //sendValue[0] = (ushort)ModeSet[0].NiuJuIDTwo; frmMain.mMain.WriteRootID.Write(cWriteRootID.AllRootSpace.风机扭矩程序号, (ushort)ModeSet[0].NiuJuIDTwo); break; case RunList.Two: Start[1] = true; //sendValue[0] = (ushort)ModeSet[1].NiuJuIDTwo; frmMain.mMain.WriteRootID.Write(cWriteRootID.AllRootSpace.风机扭矩程序号, (ushort)ModeSet[1].NiuJuIDTwo); break; } //frmMain.mMain.AllMeterData.AllCommunite[0].Sons[0].Write<ushort>(sendValue.ToList(), parm); }
private void BuildModel() { Log.Info("Building model"); this.modelBuilder = new CodeModelBuilder(); this.modelBuilder.RegisterConventionsFrom(this.conventionAssemblies.ToArray()); Log.Trace("Adding assemblies to model"); this.modelBuilder.RunMutator(new AddAssemblies(this.assembliesToAnalyze)); var enabledRules = this.toolkitAssemblies .SelectMany(x => x.GetTypes()) .Where(x => typeof(IRule).IsAssignableFrom(x) && x.IsClass && !x.IsAbstract) .Where(x => !this.config.DisabledRules.Contains(x.Name)) .ToList(); Log.Info("Enabled rules: {0}", string.Join(", ", enabledRules.Select(x => x.Name))); var mutators = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(x => x.GetTypes()) .Where(x => typeof(IMutator).IsAssignableFrom(x) && x.IsClass && !x.IsAbstract) .Select(x => new StepDescriptor(this.modelBuilder, x)); var rules = enabledRules .Select(x => new StepDescriptor(this.modelBuilder, x)) .ToList(); Log.Info("Determining runlist"); try { this.runlist = DetermineRunList(mutators, rules); } catch (NeedsNotSatisfiedException e) { Log.Error("Missing resources: {0}", e.MissingResource); throw; } catch (UnableToBuildRunListException e) { Log.Error("Unable to build runlist {0}", e.InnerException.Message); throw; } this.Report.RunList(runlist); Log.Info("Order: {0}", string.Join(", ", runlist.Elements)); foreach (var mutatorType in this.runlist.Elements.Where(x => x.IsMutator)) { Log.Debug("Running mutator {0}", mutatorType); this.modelBuilder.RunMutator(mutatorType.Type); } }
public void RunList(RunList<StepDescriptor> runlist) { this.reportModel.RunList = runlist; }
/// <summary> /// Bootstrap the machine providing the mandatory parameters /// </summary> public void Bootstrap() { // ══════════════════════════ // Check client.rb // ══════════════════════════ ChefConfig.ClientRb = ChefConfig.Root + @"\client.rb"; if (File.Exists(ChefConfig.ClientRb)) { if (_force) { Logger.log("warn", "client.rb file exists and -Force parameter is true. client.rb file will be overwritten."); File.Delete(ChefConfig.ClientRb); } else { const string badNews = "client.rb file exists. Do not Invoke-Bootstrap if chef-client is already configured."; Logger.log("fatal", badNews); Terminate(badNews); } } // ══════════════════════════ // Add Client // ══════════════════════════ Client client = new Client(); ReturnType rt = client.Add(ChefConfig.NodeName, _force); if (rt.Result == 0) { using (StreamWriter sw = new StreamWriter(ChefConfig.Root + @"\client.pem", false)) { sw.WriteLine(rt.Data); } Logger.log("ok", "Chef client is succesfully created. RSA key is saved as client.pem"); } else { Logger.log("fatal", rt.Message); Terminate(rt.Message); } // ══════════════════════════ // Create client.rb // ══════════════════════════ Dictionary <string, string> dict = new Dictionary <string, string> { { "chef_server_url", "\"" + ChefConfig.OrganizationUri + "\"" }, { "node_name", "\"" + ChefConfig.NodeName + "\"" } }; try { StreamWriter sw = new StreamWriter(ChefConfig.ClientRb); foreach (var param in dict) { sw.WriteLine("{0} {1}", param.Key, param.Value); } sw.Close(); Logger.log("ok", "Client.rb file is succesfully created."); } catch (Exception ex) { string badNews = "Error writing client.rb file: " + ex.Message; Logger.log("fatal", badNews); Terminate(badNews); } // ══════════════════════════ // Add Node // ══════════════════════════ Node node = new Node(); List <string> runlist = new List <string>(); List <string> roles = new List <string>(); if (RunList != null) { runlist = RunList.Replace(" ", String.Empty).Split(',').ToList(); } if (Roles != null) { roles = Roles.Replace(" ", String.Empty).Split(',').ToList(); } rt = node.Add(ChefConfig.NodeName, Env, runlist, roles, _force); if (rt.Result == 0) { Logger.log("ok", "Chef Node is succesfully created."); } else { Logger.log("fatal", rt.Message); Terminate(rt.Message); } // ══════════════════════════ // Create and Save Config // ══════════════════════════ // Adding ChefConfig parameters, needed for the next API connection using machine client account: ChefConfig.ClientName = ChefConfig.NodeName; ChefConfig.ClientPath = ChefConfig.Root; ChefConfig.ClientPem = ChefConfig.Root + @"\client.pem"; // Saving config ChefConfigurator chefConfigurator = new ChefConfigurator(); rt = chefConfigurator.SaveConfig(); Logger.log(rt); if (rt.Result == 4) { Terminate(rt.Message); } }