当前位置: 首页>>代码示例>>C#>>正文


C# Scheduler.SubmitJob方法代码示例

本文整理汇总了C#中Scheduler.SubmitJob方法的典型用法代码示例。如果您正苦于以下问题:C# Scheduler.SubmitJob方法的具体用法?C# Scheduler.SubmitJob怎么用?C# Scheduler.SubmitJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scheduler的用法示例。


在下文中一共展示了Scheduler.SubmitJob方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Register

        public static void Register(HttpConfiguration config)
        {
            Scheduler = new Scheduler();
            TmxGasJob = new Job();
            ForexJob = new Job();
            MyWeatherJob = new Job();
            PlantStatusJob = new Job();

            TmxGasJob.Run.From(DateTime.Now).Every.Hours(1);
            ForexJob.Run.From(DateTime.Now).Every.Hours(1);
            MyWeatherJob.Run.From(DateTime.Now).Every.Days(1);
            PlantStatusJob.Run.From(DateTime.Now).Every.Minutes(5);

            TmxGasJob.Pause();
            ForexJob.Pause();
            MyWeatherJob.Pause();
            PlantStatusJob.Pause();

            Scheduler.SubmitJob(TmxGasJob, p => GasIndexDownloader.Process());
            Scheduler.SubmitJob(ForexJob, p => ForexDownloader.Process());
            Scheduler.SubmitJob(TmxGasJob, p => MyWeatherDownloader.Process());
            Scheduler.SubmitJob(PlantStatusJob, p => PlantStatusDownloader.Process());

            var context = new TBSPEntities1();
            IQueryable<AppSetting> backgroundEnabled = (context.AppSettings.Where(
                appSetting => appSetting.Description == "BackgroundQueueEnabled")
                ).Take(1);

            if (!backgroundEnabled.Any()) throw new Exception("Unable to find background queue config");

            if (!backgroundEnabled.First().Value.ToUpper().Equals("TRUE"))
            {
                TBSPLogger.Info("SchedulerConfig", "Skipping Background Jobs");
            }
            else
            {
                TBSPLogger.Info("SchedulerConfig", "Starting Background Jobs");

                TmxGasJob.Resume();
                ForexJob.Resume();
                MyWeatherJob.Resume();
                PlantStatusJob.Resume();
            }
        }
开发者ID:Transcanada-TRPS,项目名称:TBOT,代码行数:44,代码来源:SchedulerConfig.cs

示例2: ScheduleJob

        private static void ScheduleJob(Scheduler scheduler, ISchedulerJob job) {
            var outWin = (IVsOutputWindow)HpcSupportPackage.GetGlobalService(typeof(IVsOutputWindow));

            IVsOutputWindowPane pane;
            if (ErrorHandler.Succeeded(outWin.GetPane(VSConstants.GUID_OutWindowGeneralPane, out pane))) {
                pane.Activate();

                pane.OutputString("Submitting job " + job.Id + Environment.NewLine);
            }

            var shell = (IVsUIShell)HpcSupportPackage.GetGlobalService(typeof(SVsUIShell));
            IntPtr owner;
            if (ErrorHandler.Succeeded(shell.GetDialogOwnerHwnd(out owner))) {
                scheduler.SetInterfaceMode(false, owner);
            }


            ThreadPool.QueueUserWorkItem(x => {
                try {
                    scheduler.SubmitJob(job, null, null);
                } catch (Exception ex) {
                    string msg;
                    msg = "Failed to submit job " + ex.ToString();
                    if (pane != null) {
                        pane.OutputString(msg);
                    } else {
                        MessageBox.Show(msg, "Python Tools for Visual Studio");
                    }
                }
            });
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:31,代码来源:HpcLauncher.cs


注:本文中的Scheduler.SubmitJob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。