From 16dc159ec45091e63166b470e9302bca52e58597 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Sat, 19 Apr 2014 01:38:20 +0200 Subject: [PATCH 1/2] 100% fixes; thx ruff --- bin/linspector | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/bin/linspector b/bin/linspector index 275dc0c..e08aee7 100755 --- a/bin/linspector +++ b/bin/linspector @@ -131,21 +131,19 @@ def main(): time_delta = 0 jobs = [] count = 0 - percent = 0 + percent = float(0) + increment = float(100) / float(job_count ) for layout in lin_conf.get_enabled_layouts(): for hostgroup in layout.get_hostgroups(): for service in hostgroup.get_services(): for host in hostgroup.get_hosts(): for period in service.get_periods(): - count += 1 - if job_count >= 100: - if count % (job_count/100) == 0: - percent += 1 - sys.stdout.write("Scheduling jobs. Be patient... " + str(percent) + "%\r") - sys.stdout.flush() - else: - sys.stdout.write("Scheduling jobs. Be patient...\r") + percent += increment + if percent >= count: + sys.stdout.write("Scheduling jobs. Be patient... " + str(count) + "%\r") sys.stdout.flush() + while percent > count: + count += 1 time_delta += float(args.delay) new_start_date = start_date + datetime.timedelta(seconds=time_delta) From 098796b7ab2c97808f747e71e9d48ac59a7fe5e4 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Sat, 19 Apr 2014 01:51:33 +0200 Subject: [PATCH 2/2] wuhuuuuu --- bin/linspector | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/linspector b/bin/linspector index e08aee7..2c5352a 100755 --- a/bin/linspector +++ b/bin/linspector @@ -117,7 +117,7 @@ def main(): exit() scheduler = LinspectorScheduler({"apscheduler.threadpool.core_threads": args.corethreads, - "apscheduler.threadpool.max_threads": args.threads}) + "apscheduler.threadpool.max_threads": args.threads}) TaskExecutor.Instance() @@ -152,6 +152,7 @@ def main(): hostgroup.get_members(), core, hostgroup) + scheduler_job = period.createJob(scheduler, job, handle_job, start_date=new_start_date) scheduler_job.misfire_grace_time = 2 if scheduler_job is not None: