コード例 #1
0
ファイル: AerisJob.cs プロジェクト: ndrwwlf/WeatherRegression
        public Task Execute(IJobExecutionContext context)
        {
            _aerisJobParams    = AerisJobParamsValueOf(context);
            _weatherRepository = _weatherRepositoryValueOf(_aerisJobParams);

            //Log.Information("\nWeather job starting...\n");

            //var clock = System.Diagnostics.Stopwatch.StartNew();

            //GatherWeatherData();
            //clock.Stop();

            //var t = clock.Elapsed;

            //Log.Error(t.ToString());

            _sPRegressionJob.Execute(context);

            //PopulateWthExpUsageTable();

            //Log.Information($"WeatherData gathered and WthExpUsage calculated for Readings going back to {fromDateStart.ToShortDateString()}");
            //Log.Information("\nWeather job finished.\n");

            //PopulateWthNormalParams();

            return(Task.FromResult(0));
        }
コード例 #2
0
        public static async Task RunAsync(AerisJobParams aerisJobParams)
        //public static async Task RunAsync()
        {
            try
            {
                IScheduler scheduler;
                var        schedulerFactory = new StdSchedulerFactory();
                scheduler = schedulerFactory.GetScheduler().Result;
                scheduler.Context.Put("aerisJobParams", aerisJobParams);
                scheduler.Start().Wait();

                //int ScheduleIntervalInMinute = 1;//job will run every minute
                JobKey aerisKey = JobKey.Create("AerisJob");
                //JobKey regressionKey = JobKey.Create("RegressionJob");
                JobKey sPRegressionKey = JobKey.Create("SPRegressionJob");

                IJobDetail aerisJob = JobBuilder.Create <AerisJob>().WithIdentity(aerisKey).Build();
                //IJobDetail regressionJob = JobBuilder.Create<RegressionJob>().WithIdentity(regressionKey).Build();
                IJobDetail sPRegressionJob = JobBuilder.Create <SPRegressionJob>().WithIdentity(sPRegressionKey).Build();

                ITrigger aerisTrigger = TriggerBuilder.Create()
                                        .WithIdentity("AerisTrigger")
                                        .StartNow()
                                        .WithSimpleSchedule(x => x.WithIntervalInSeconds(5).WithRepeatCount(0))
                                        .Build();

                DateTimeOffset aerisJobFinished = await scheduler.ScheduleJob(aerisJob, aerisTrigger);

                //ITrigger regressionTrigger = TriggerBuilder.Create()
                //    .WithIdentity("RegressionTrigger")
                //    .StartAt(aerisJobFinished)
                //    .WithSimpleSchedule(x => x.WithIntervalInSeconds(5).WithRepeatCount(0))
                //    .Build();

                //ITrigger sPRegressionTrigger = TriggerBuilder.Create()
                //    .WithIdentity("SPRegressionTrigger")
                //    .StartAt(aerisJobFinished)
                //    .WithSimpleSchedule(x => x.WithIntervalInSeconds(5).WithRepeatCount(0))
                //    .Build();

                ////await scheduler.ScheduleJob(regressionJob, regressionTrigger);
                //await scheduler.ScheduleJob(sPRegressionJob, sPRegressionTrigger);
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e.Message);
                Log.Error(e.StackTrace);
            }
        }
コード例 #3
0
        public void Execute(IJobExecutionContext context)
        {
            _aerisJobParams    = AerisJobParamsValueOf(context);
            _weatherRepository = _weatherRepositoryValueOf(_aerisJobParams);

            Log.Information("Starting WNRdngData01RegressionJob..");
            var regressionWatch = System.Diagnostics.Stopwatch.StartNew();

            PopulateWthNormalParams();

            regressionWatch.Stop();
            var t = regressionWatch.Elapsed;

            Log.Information("Finished WNRdngData01RegressionJob. Time elapsed: " + t.ToString());
        }
コード例 #4
0
        public Task Execute(IJobExecutionContext context)
        {
            _aerisJobParams    = AerisJobParamsValueOf(context);
            _weatherRepository = _weatherRepositoryValueOf(_aerisJobParams);

            var watch = System.Diagnostics.Stopwatch.StartNew();

            PopulateWthNormalParams();
            watch.Stop();

            var t = watch.Elapsed.Seconds;

            Console.WriteLine(t);

            //PopulateMyWthExpUsage();

            return(Task.FromResult(0));
        }
コード例 #5
0
 private IWeatherRepository _weatherRepositoryValueOf(AerisJobParams aerisJobParams)
 {
     return(new WeatherRepository(aerisJobParams));
 }