multiprocessing stuff, a lot of small improvements. has many bugs actually
This commit is contained in:
parent
259c6ee0f0
commit
1cdaec5441
2 changed files with 8 additions and 12 deletions
|
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
"""
|
||||
|
||||
|
||||
__version__ = "0.15.1/AMNESIA"
|
||||
__version__ = "0.15.2/AMNESIA"
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
|
|
@ -130,10 +130,6 @@ def main():
|
|||
process = LinspectorWorker(name, args.corethreads, args.threads)
|
||||
workers.append(process)
|
||||
process.daemon = True
|
||||
#process.start()
|
||||
|
||||
for worker in workers:
|
||||
print "RESULT is %s" % worker.get_scheduler_name()
|
||||
|
||||
start_date = datetime.datetime.now()
|
||||
time_delta = 0
|
||||
|
|
@ -166,13 +162,14 @@ def main():
|
|||
if instance == args.instances:
|
||||
instance = 0
|
||||
|
||||
schedulers = []
|
||||
for worker in workers:
|
||||
schedulers.append(worker.get_scheduler())
|
||||
worker.start()
|
||||
|
||||
print("\nScheduled " + str(job_count) + " jobs")
|
||||
|
||||
#TODO: add a list of workers and not only the last one; just a hack to make it run for testing
|
||||
interface = LinspectorInterface(jobs, worker.get_scheduler(), lin_conf, root_logger, __version__)
|
||||
interface = LinspectorInterface(jobs, schedulers, lin_conf, root_logger, __version__)
|
||||
|
||||
if "jsonrpc_backend" in core and core["jsonrpc_backend"]:
|
||||
from linspector.backends.jsonrpc import JsonrpcBackend
|
||||
|
|
|
|||
|
|
@ -36,17 +36,17 @@ class LinspectorWorker(Process):
|
|||
|
||||
self.scheduler = LinspectorScheduler({"apscheduler.threadpool.core_threads": self.core_threads,
|
||||
"apscheduler.threadpool.max_threads": self.max_threads})
|
||||
|
||||
self.scheduler.standalone = True
|
||||
|
||||
def run(self):
|
||||
self.scheduler.start()
|
||||
|
||||
def handle_job(self, job):
|
||||
@staticmethod
|
||||
def handle_job(job):
|
||||
job.handle_call()
|
||||
|
||||
def get_scheduler_name(self):
|
||||
return "Process returned %s" % self.name + " " + str(self.scheduler)
|
||||
def get_name(self):
|
||||
return self.name
|
||||
|
||||
def get_scheduler(self):
|
||||
return self.scheduler
|
||||
|
|
@ -57,7 +57,6 @@ class LinspectorWorker(Process):
|
|||
def create_job(self, jobs, service, host, hostgroup, core, period, start_date=None):
|
||||
job = LinspectorJob(service, host, hostgroup.get_members(), core, hostgroup)
|
||||
scheduler_job = period.createJob(self.scheduler, job, self.handle_job, start_date=start_date)
|
||||
|
||||
if scheduler_job is not None:
|
||||
job.set_job(scheduler_job)
|
||||
jobs.append(job)
|
||||
Loading…
Add table
Add a link
Reference in a new issue