public void CreateJobDefinitions_ForJobWithMissingName_WillThrowException() { StringReader sr = TestHelper.GetFileContents("test-jobs-missing-name.json"); var ex = Assert.Throws <Exception>(() => JobConfig.CreateJobDefinitions(sr)); Assert.AreEqual("Failed to create job defintions from config - one or more of the jobs has a blank or missing JobName value", ex.Message); }
public void CreateJobDefinitions_ForValidConfig_WillProvideDefinitions() { StringReader sr = TestHelper.GetFileContents("test-jobs.json"); var definitions = JobConfig.CreateJobDefinitions(sr); Assert.AreEqual(3, definitions.Count); }
public void CreateJobDefinitions_ForJobsWithMissingOnFailureDependencies_WillThrowException() { StringReader sr = TestHelper.GetFileContents("test-jobs-missing-onfailure-job.json"); var ex = Assert.Throws <Exception>(() => JobConfig.CreateJobDefinitions(sr)); Assert.AreEqual("Failed to create job definitions from config - job 'Job3' has a dependency 'Job2' that does not exist", ex.Message); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseHangfireDashboard(); JobConfig.RegisterJobs(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); }
public void TestLogTrigger() { tf.Client.CreateService(new CreateServiceRequest(Service)); byte[] contents = File.ReadAllBytes(Directory.GetCurrentDirectory() + "/hello.zip"); var code = new Code(Convert.ToBase64String(contents)); tf.Client.CreateFunction(new CreateFunctionRequest(Service, Function, "python3", "index.handler", code, "desc")); string triggerName = "my-log-trigger"; SouceConfig source = new SouceConfig(tf.LogStore + "_source"); LogConfig logConfig = new LogConfig(tf.LogProject, tf.LogStore); JobConfig jobConfig = new JobConfig(60, 10); var functionParameter = new Dictionary <string, object> { }; var logTriggerConfig = new LogTriggerConfig(source, jobConfig, functionParameter, logConfig, false); string sourceArn = string.Format("acs:log:{0}:{1}:project/{2}", tf.Region, tf.AccountID, tf.LogProject); var response = tf.Client.CreateTrigger(new CreateTriggerRequest(Service, Function, triggerName, "log", sourceArn, tf.InvocationRole, logTriggerConfig, "log trigger desc")); this.Triggers.Add(triggerName); Assert.Equal(triggerName, response.Data.TriggerName); Assert.Equal("log trigger desc", response.Data.Description); Assert.Equal("log", response.Data.TriggerType); Assert.Equal(sourceArn, response.Data.SourceArn); Assert.Equal(tf.InvocationRole, response.Data.InvocationRole); Assert.Equal(JsonConvert.DeserializeObject <LogTriggerConfig>(response.Data.TriggerConfig.ToString()), logTriggerConfig); }
private void ExportToGltf(JobConfig config, RuntimeLog log, Action <int> progressCallback) { var features = new Dictionary <Common.Formats.Gltf.FeatureType, bool>(); var options = config.OutputOptions; if (options != null && options.Count > 0) { foreach (var option in options) { if (Enum.TryParse(option, true, out Common.Formats.Gltf.FeatureType result)) { features[result] = true; } } } var setting = new Bimangle.ForgeEngine.Common.Formats.Gltf.Navisworks.ExportSetting(); setting.OutputPath = config.OutputPath; setting.Features = features?.Where(x => x.Value).Select(x => x.Key).ToList(); #if EXPRESS var exporter = new Bimangle.ForgeEngine.Navisworks.Express.Gltf.Exporter(App.GetHomePath()); #else var exporter = new Bimangle.ForgeEngine.Navisworks.Pro.Gltf.Exporter(App.GetHomePath()); #endif exporter.Export(setting, log, progressCallback, CancellationToken.None); }
/// <summary> /// Initializes a new instance of the <see cref="PoolConfig"/> class. /// </summary> /// <param name="config">The configuration.</param> /// <param name="coinConfig"></param> public PoolConfig(dynamic config, ICoinConfig coinConfig) { try { Enabled = config.enabled ? config.enabled : false; if (Enabled == false) // if the configuration is not enabled { return; // just skip reading rest of the parameters. } Coin = coinConfig; // assign the coin config. // load the sections. Daemon = new DaemonConfig(config.daemon); Meta = new MetaConfig(config.meta); Wallet = new WalletConfig(config.wallet); Rewards = new RewardsConfig(config.rewards); Payments = new PaymentConfig(config.payments); Miner = new MinerConfig(config.miner); Job = new JobConfig(config.job); Stratum = new StratumServerConfig(config.stratum); Banning = new BanConfig(config.banning); Storage = new RedisConfig(config.storage.redis); Vanilla = new VanillaServerConfig(config.vanilla); Valid = true; } catch (Exception e) { Valid = false; Log.Logger.ForContext <PoolConfig>().Error(e, "Error loading pool configuration"); } }
private void ConfigAndSetStartDateToRetrieve(ConnectionStringSettings configCS, int daysResend, out Stopwatch timerTokenRefresh, out APIMethods api, out GetLastResult _lastExportDate) { _config = new JobConfig { FarmaticConnectionString = configCS.ConnectionString, ProviderConnectionString = configCS.ProviderName, APIEndpoint = ConfigurationManager.AppSettings["APIEndpoint"], APIUser = ConfigurationManager.AppSettings["APIUser"], APIPwd = ConfigurationManager.AppSettings["APIPwd"], JWTAuthRoute = ConfigurationManager.AppSettings["APITokenEndpoint"], APIGetVentaData = ConfigurationManager.AppSettings["APIGetVentaData"], APIPostVentaData = ConfigurationManager.AppSettings["APIPostVentaData"], APIPostVentaDataRange = ConfigurationManager.AppSettings["APIPostVentaDataRange"], APICodUsuario = ConfigurationManager.AppSettings["APICodUsuario"], DaysToResend = daysResend, UseAPIRangeMethod = bool.Parse(ConfigurationManager.AppSettings["UseAPIRangeMethod"]) }; // try webApi retrieve lastrecord to limit request timerTokenRefresh = new Stopwatch(); timerTokenRefresh.Start(); api = new APIMethods(_config); api.SetToken(); if (api.TokenData == null) { throw new System.Exception($"Could not obtain token from WebAPI, endpoint root was {_config.APIEndpoint}"); } // 2. Get 'last export date' (if I can add column: ExportDate, if not fallback to use FechaVenta) data from webAPI _lastExportDate = api.GetLastExportInfo(); DateTime searchFrom = DateTime.Now; }
public override Task <Stat> LoadJobConfig(CellJobConfig config, ServerCallContext context) { try { var jobConfig = new JobConfig { Connections = config.Connections, ConcurrentConnections = config.ConcurrentConnections, // Slaves = config.Slaves, Interval = config.Interval, Duration = config.Duration, ServerUrl = config.ServerUrl, Pipeline = new List <string>(config.Pipeline.Split(';')), }; // TODO: handle exception if (_sigWorker == null) { _sigWorker = new SigWorker(); } _sigWorker.LoadJobs(jobConfig); _sigWorker.UpdateState(Stat.Types.State.ConfigLoaded); return(Task.FromResult(new Stat { State = Stat.Types.State.ConfigLoaded })); } catch (Exception ex) { Util.Log($"Exception: {ex}"); throw; } }
/// <summary> /// /// </summary> private void InitDataBindings() { Binding jobListBinding = new() { Source = MyJobManager, Path = new PropertyPath(nameof(MyJobManager.RecentJobIds)), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(RecentJobsListView, ItemsControl.ItemsSourceProperty, jobListBinding); Binding filterBinding = new() { Source = MyJobManager, Path = new PropertyPath(nameof(MyJobManager.RecentJobsFilter)), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(SearchField.SearchTextbox, TextBox.TextProperty, filterBinding); } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RecentJobsListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender is ListView recentJobsListView && recentJobsListView.SelectedItem is string jobId) { JobConfig jobConfig = MyJobManager.GetJobConfig(jobId); _openJob(jobConfig); } }
/// <summary> /// /// </summary> /// <param name="jobConfig"></param> private void OpenJob(JobConfig jobConfig) { if (jobConfig == null) { return; } MyJobManager.SelectedJobConfig = jobConfig; MyJobManager.AddRecentJob(jobConfig); SwitchJobButtonsVisibility(true); if (!MyJobManager.IsJobOpened(jobConfig)) { MyJobManager.AddOpenedJob(jobConfig); } string path = MyJobManager.GetJobConfigPath(jobConfig); Page page = new SettingsPage(_settingsStartPage, jobConfig, new JobWriter(path)); FrameTabItem item = OpenPage(jobConfig.Id, page, _settingsStartPage); item.IsJobPage = true; if (_jobExplorerExpanded) { SwitchJobbExplorerExpanded(); } }
/// <summary> /// /// </summary> /// <param name="jobIdParameters"></param> internal static void ScheduleJobs(List <string> jobIdParameters) { DateTime startTime = DateTime.Now; log.Info(LocalizationService.FormatResourceString("JobSchedulerMessage01", startTime)); ErrorControlService.GetService().StartRuntimeStopwatch(); JobManager manager = JobManager.GetJobManager(); if (manager.AllJobs == null) { return; } int jobCount = manager.AllJobs.Count; List <string> jobIds = new(jobCount); for (int i = 0; i < jobCount; i++) { JobConfig jobConfig = manager.AllJobs[i]; if (jobConfig == null) { continue; } ExitWhenInvalidId(jobIds, jobConfig.Id); InitNewThread(jobIdParameters, jobIds, jobConfig); } LogTime(startTime); }
// --------------------------------------------------// protected override void Awake() { if (null == Globals.Instance.MGUIManager) { return; } base.Awake(); Globals.Instance.MSceneManager.ChangeCameraActiveState(SceneManager.CameraActiveState.TASKCAMERA); playerData = Globals.Instance.MGameDataManager.MActorData; jobConfig = Globals.Instance.MDataTableManager.GetConfig <JobConfig>(); jobPlaceConfig = Globals.Instance.MDataTableManager.GetConfig <JobPlaceConfig>(); UIEventListener.Get(BackHomeBtn.gameObject).onClick += delegate(GameObject go) { this.Close(); }; UIEventListener.Get(BackBtn.gameObject).onClick += delegate(GameObject go) { NGUITools.SetActive(JobPlaceUIScrollView.gameObject, true); NGUITools.SetActive(JobInformation.gameObject, false); }; RefreshLabel.text = ShowRefreshTime(); FristCacheJobListInfor(); }
static void ScheduleJobs(string instance) { var scheduler = Schedulers.Get(instance); foreach (var behaviorType in BehaviorTypes.All()) { var jobName = "Recompute similarity matrix (" + behaviorType + ")"; var config = JobConfig.Load(instance, jobName); if (config == null) { config = new JobConfig { JobName = jobName, Interval = TimeSpan.FromHours(24), StartTime = new TimeOfDay(2, 0) }; } var job = new RecomputeSimilarityMatrixJob(); scheduler.Schedule(jobName, job, config.Interval, config.StartTime, new Dictionary <string, string> { { "BehaviorType", behaviorType } }); } }
public static void AddTimedJobs <T>(this IServiceCollection coll, IEnumerable <ITimedJob> jobs) where T : class, IJobRunner { JobConfig conf = new JobConfig(jobs); coll.AddTransient <IJobRunner, T>(); coll.AddSingleton(conf); }
/// <summary> /// Schedule a batch job /// </summary> /// <returns></returns> private JobConfig ScheduleSingleJob(JobDeploymentSession job, string destFolder, JsonConfig defaultJobConfig, bool isOneTime, TimeSpan interval, TimeSpan window, DateTime processTime, DateTime scheduledTime, string prefix = "") { var ps_s = processTime; var ps_e = processTime.Add(interval).AddMilliseconds(-1); //ENDTIME var pe_s = ps_s.Add(-window); var pe_e = ps_e.Add(-window); // STARTTIME var dateString = ConvertDateToString(scheduledTime); var suffix = prefix + $"-{Regex.Replace(dateString, "[^0-9]", "")}"; var jobName = job.Name + suffix; job.SetStringToken("name", jobName); Ensure.NotNull(defaultJobConfig, "defaultJobConfig"); var processStartTime = ConvertDateToString(pe_e); var processEndTime = ConvertDateToString(ps_e); destFolder = GetJobConfigFilePath(isOneTime, dateString, destFolder); var jc = new JobConfig { Content = GetBatchConfigContent(job, defaultJobConfig.ToString(), processStartTime, processEndTime), FilePath = ResourcePathUtil.Combine(destFolder, job.Name + ".conf"), Name = jobName, SparkJobName = job.SparkJobName + suffix, ProcessStartTime = processStartTime, ProcessEndTime = processEndTime, ProcessingTime = dateString, IsOneTime = isOneTime }; return(jc); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); LogProvider.SetCurrentLogProvider(new CustomConsoleLogProvider()); } else { app.UseExceptionHandler("/Job/Error"); } app.UseStaticFiles(); app.UseCookiePolicy(); Log4NetHelper.Instance.InitLog(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Job}/{action=JobListIndex}/{id?}"); }); JobConfig.SetJobStoreType(JobStoreType.AdoJobStore); JobManger.RunJob(); }
private bool StartExport(JobConfig jobConfig, RuntimeLog log, Action <int> progressCallback) { var targetFormat = jobConfig.Format?.Trim().ToLowerInvariant(); switch (targetFormat) { case @"gltf": ExportToGltf(jobConfig, log, progressCallback); break; case @"3dtiles": ExportToCesium3DTiles(jobConfig, log, progressCallback); break; #if !EXPRESS case @"svf": ExportToSvf(jobConfig, log, progressCallback); break; #endif default: log.Log(@"Fail", @"Startup", $@"Unsupported format - {targetFormat}"); return(false); } return(true); }
private void selectPanel_SelectedIndexChanged() { selectJobId = jobIdList[baseid + selectPanel.SelectIndex]; JobConfig jobConfig = ConfigData.GetJobConfig(selectJobId); jobDes.UpdateText(jobConfig.Des); virtualRegion.SetRegionKey(1, jobConfig.SkillId); for (int i = 2; i < 5; i++)//把后面的物件都清除下 { virtualRegion.SetRegionKey(i, 0); } cellTypeList.Clear(); if (!UserProfile.Profile.InfoRecord.CheckFlag((uint)MemPlayerFlagTypes.SelectJob)) { #region 显示第一次选职业的奖励 int imgIndex = 2; if (jobConfig.InitialCards != null)//初始卡牌 { foreach (var cardId in jobConfig.InitialCards) { if (cardId > 0) { virtualRegion.SetRegionType(imgIndex, PictureRegionCellType.Card); virtualRegion.SetRegionKey(imgIndex++, cardId); cellTypeList.Add(PictureRegionCellType.Card); } } } if (jobConfig.InitialEquip != null)//初始道具 { foreach (var eid in jobConfig.InitialEquip) { if (eid > 0) { virtualRegion.SetRegionType(imgIndex, PictureRegionCellType.Equip); virtualRegion.SetRegionKey(imgIndex++, eid); cellTypeList.Add(PictureRegionCellType.Equip); } } } if (jobConfig.InitialEquip != null)//初始道具 { foreach (var eid in jobConfig.InitialItem) { if (eid > 0) { virtualRegion.SetRegionType(imgIndex, PictureRegionCellType.Item); virtualRegion.SetRegionKey(imgIndex++, eid); cellTypeList.Add(PictureRegionCellType.Item); } } } #endregion } bitmapButtonSelect.Visible = !jobConfig.InitialLocked || UserProfile.Profile.InfoBasic.AvailJobList.Contains(selectJobId); Invalidate(); }
/// <summary> /// 生成触发器实例 /// </summary> private static ITrigger CreateTrigger(JobConfig schedule) { return(TriggerBuilder .Create() .WithCronSchedule(schedule.Cron) .WithDescription(schedule.Cron) .Build()); }
public FacebookWebBrowser(JobConfig config, List <PostWallMessage> postWallMessages, List <SendMessage> sendMessages) { InitializeComponent(); this.Config = config; this.PostWallMessages = postWallMessages; this.SendMessages = sendMessages; userIndex = 0; this.Load += FacebookWebBrowser_Load; }
private void BtnOpen_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "Facebook App File | *.fajob"; ofd.Multiselect = false; if (ofd.ShowDialog() == DialogResult.OK) { jobConfig = new JobConfig(); if (jobConfig.Open(ref jobConfig, ofd.FileName)) { Cbtype.SelectedIndex = jobConfig.Type; chbtimming1.Checked = jobConfig.TimmingConfig.IsUsedOne; chbtimming2.Checked = jobConfig.TimmingConfig.IsUsedTwo; chbtimming3.Checked = jobConfig.TimmingConfig.IsUsedThree; chbtimming4.Checked = jobConfig.TimmingConfig.IsUsedFour; dttimming1.Value = DateTime.Now.Date.AddSeconds(jobConfig.TimmingConfig.TimeOne); dttimming2.Value = DateTime.Now.Date.AddSeconds(jobConfig.TimmingConfig.TimeTwo); dttimming3.Value = DateTime.Now.Date.AddSeconds(jobConfig.TimmingConfig.TimeThree); dttimming4.Value = DateTime.Now.Date.AddSeconds(jobConfig.TimmingConfig.TimeFour); nudinterval.Value = jobConfig.IntervalConfig.Interval; chbRunNow.Checked = jobConfig.IntervalConfig.IsRunNow; nudnotify.Value = jobConfig.NotifyBeforeTime; for (int i = 0; i < chblusers.Items.Count; i++) { chblusers.SetItemChecked(i, false); } foreach (var user in jobConfig.UserConfigs) { for (int i = 0; i < chblusers.Items.Count; i++) { if (user.UserName == (string)chblusers.Items[i]) { chblusers.SetItemChecked(i, true); break; } } } chbsendmessage.Checked = jobConfig.IsSendMessage; chbpostwall.Checked = jobConfig.IsPostWall; nudpeoplecount.Value = jobConfig.CountPeople; Until.ShowInfoBox("Open successfully"); } else { Until.ShowErrorBox("Open Failed"); } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void JobListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender is ListView jobListView) { string jobId = jobListView.SelectedItem as string; JobConfig jobConfig = MyJobManager.GetJobConfig(jobId); OpenJob(jobConfig); } }
public Job(JobCode jobCode) { JobConfig config = JobSettings.Instance.GetJobConfig(jobCode); code = jobCode; color = config.Color; name = config.Name; sprite = config.Sprite; }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); JobConfig.RegisterJobs(); }
public Job(JobCode jobCode) { JobConfig config = JobManager.Instance.GetJobConfig(jobCode); code = jobCode; color = config.Color; name = config.Name; sprite = config.Sprite; backgroundSprite = config.BackgroundSprite; }
/// <summary> /// Implementation of the Init() interface for IJobTask. /// </summary> /// <param name="config"></param> void IJobTask.Init(JobConfig config) { this.Config = config; if (config.Config["EndPoint"] == null || String.IsNullOrEmpty(config.Config["EndPoint"])) { throw new ArgumentNullException("EndPoint is required."); } this.EndPoint = config.Config["EndPoint"]; }
/// <summary> /// 生成工作实例 /// </summary> private static IJobDetail CreateJob(JobConfig schedule) { var jobType = schedule.JobType; return(JobBuilder .Create(jobType) .SetJobData(new JobDataMap(schedule.DataDic)) .WithDescription(jobType.Name) .Build()); }
static JobConfig createSimpleJob() { JobConfig config = new JobConfig(DateTime.UtcNow.Ticks , "" , "MyJobService.SimpleJob"); config.Config["input"] = "Hello World!"; return(config); }
public void Initialize(string configFile) { Lib.InitializeLibrary(); if (!File.Exists(configFile)) { throw new Exception("Luratech config file not found: " + configFile); } jobConfig = new JobConfig(configFile); }