예제 #1
0
        public static void Update(string instance, JobConfig config)
        {
            if (String.IsNullOrEmpty(config.JobName))
                throw new ArgumentException("config.JobName is required.");

            var file = RecommendationsDataFolder.For(instance).GetFile("Config/Jobs/" + config.JobName + ".config");
            file.Write(config);
        }
예제 #2
0
        public static void Update(string instance, JobConfig config)
        {
            if (String.IsNullOrEmpty(config.JobName))
            {
                throw new ArgumentException("config.JobName is required.");
            }

            var file = RecommendationsDataFolder.For(instance).GetFile("Config/Jobs/" + config.JobName + ".config");

            file.Write(config);
        }
        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 }
                });
            }
        }