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


C# Scheduler.AddJob方法代码示例

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


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

示例1: AddJobTest

 public void AddJobTest()
 {
     Owner owner = new Owner("Testuser"+userId++);
       Scheduler target = new Scheduler();
       Job job = new Job("AddJob Test", owner, 6, 4);
       target.AddJob(job);
      Job job2 = target.PopJob();
       Assert.AreSame(job, job2);
 }
开发者ID:ButterFree,项目名称:AS38,代码行数:9,代码来源:SchedulerTest.cs

示例2: Main

        static void Main(string[] args)
        {
            var builder = new ContainerBuilder();
            builder.RegisterType<EnglishHello>().As<IHello>();

            builder.RegisterType<SampleJob>().AsSelf();

            var container = builder.Build();

            var scheduler = new Scheduler(containerFactory: new AutofacContainerFactory(container));

            scheduler.AddJob<SampleJob>(cfg => cfg.RunEvery(TimeSpan.FromSeconds(1)));

            Console.ReadLine();
        }
开发者ID:hash,项目名称:trigger.net,代码行数:15,代码来源:Program.cs

示例3: ContainsTest

        public void ContainsTest()
        {
            Scheduler target = new Scheduler();

              // Add jobs and assert
              uint max = 10;
              Job[] jobs = new Job[max];
              for (uint i = 1; i <= max; i++) {
            Job job = new Job("Contains test "+i, owner, 1, i/2);
            jobs[i - 1] = job;
            target.AddJob(job);
            Assert.IsTrue(target.Contains(job));
              }
              // Remove jobs and assert
              for (uint i = max - 1; i > 0; i--) {
            target.RemoveJob(jobs[i]);
            Assert.IsFalse(target.Contains(jobs[i]));
              }
        }
开发者ID:ButterFree,项目名称:AS38,代码行数:19,代码来源:SchedulerTest.cs

示例4: TotalNumberOfJobsTest

        public void TotalNumberOfJobsTest()
        {
            Scheduler target = new Scheduler();

              // Add jobs and assert
              uint max = 10;
              Job[] jobs = new Job[max];
              Assert.AreEqual((uint)0, target.TotalNumberOfJobs());
              for (uint i = 1; i <= max; i++) {
            Job job = new Job("TotalNumberOfJobs test"+i, owner, 1, i/2);
            jobs[i - 1] = job;
            target.AddJob(job);
            Assert.AreEqual(i, target.TotalNumberOfJobs());
              }

              // Remove jobs and assert
              for (uint i = max - 1; i > 0; i--) {
            target.RemoveJob(jobs[i]);
            Assert.AreEqual(i, target.TotalNumberOfJobs());
              }
        }
开发者ID:ButterFree,项目名称:AS38,代码行数:21,代码来源:SchedulerTest.cs

示例5: RemoveJobTest

 public void RemoveJobTest()
 {
     Scheduler target = new Scheduler();
       Job job = new Job("RemoveJob test", owner, 4, (float)1.4);
       target.AddJob(job);
       target.RemoveJob(job);
       Assert.IsNull(target.PopJob());
 }
开发者ID:ButterFree,项目名称:AS38,代码行数:8,代码来源:SchedulerTest.cs

示例6: PopJobTest

        public void PopJobTest()
        {
            Job job1 = new Job("PopJob test 1", owner, 6, (float)5.0);
              Job job2 = new Job("PopJob test 2", owner, 1, (float)1.2);
              Scheduler target = new Scheduler();
              target.AddJob(job1);
              System.Threading.Thread.Sleep(1);
              target.AddJob(job2);

              Job expected = job1;
              Job actual = target.PopJob();
              Assert.AreEqual(expected.name, actual.name);
        }
开发者ID:ButterFree,项目名称:AS38,代码行数:13,代码来源:SchedulerTest.cs

示例7: LaunchFile

        public int LaunchFile(string filename, bool debug) {
            var clusterEnv = new ClusterEnvironment(_project.GetProperty(ClusterOptions.RunEnvironmentSetting));

            if (debug) {
                EnsureHiddenForm();
                EnsureListenerThread();
            }

            string workingDir, publishUrl;
            if (clusterEnv.HeadNode == "localhost") {
                workingDir = _project.GetProperty(ClusterOptions.WorkingDirSetting);
                if (String.IsNullOrWhiteSpace(workingDir)) {
                    workingDir = Path.Combine(Path.GetTempPath(), "HpcPyDebug" + Guid.NewGuid().ToString());
                }
                if (!Directory.Exists(workingDir)) {
                    Directory.CreateDirectory(workingDir);
                }

                publishUrl = "file://" + workingDir;
            } else {
                workingDir = GetWorkingDir(clusterEnv);

                // make sure we have a valid deployement dir as well
                string deploymentDir;
                if (!TryGetDeploymentDir(out deploymentDir)) {
                    return VSConstants.S_OK;
                }
                publishUrl = deploymentDir;
            }            

            string exe, arguments;
            if (!TryBuildCommandLine(debug, clusterEnv, filename, workingDir, out exe, out arguments) || 
                !TryPublishProject(clusterEnv, publishUrl)) {
                return VSConstants.S_OK;
            }

            if (clusterEnv.HeadNode == "localhost") {
                // run locally               
                if (debug) {
                    var startInfo = new ProcessStartInfo(exe, arguments);

                    LaunchRedirectedToVsOutputWindow(startInfo, false);
                } else {
                    Process.Start(exe, arguments);
                }
            } else {
                EnsureGeneralPane();

                var commandLine = exe + " " + arguments;

                var scheduler = new Scheduler();
                scheduler.Connect(clusterEnv.HeadNode);
                var job = CreateSchedulerJob(commandLine, clusterEnv, scheduler, debug);

                scheduler.AddJob(job);
                SetStatus("Scheduling job on server...");

                ScheduleJob(scheduler, job);
            }

            return VSConstants.S_OK;
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:62,代码来源:HpcLauncher.cs


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