|
@@ -14,8 +14,8 @@ from eventlet.event import Event
|
|
|
|
|
|
|
|
|
from pycs.database.Project import Project
|
|
|
-from pycs.jobs.Job import Job
|
|
|
from pycs.frontend.notifications.NotificationManager import NotificationManager
|
|
|
+from pycs.jobs.Job import Job
|
|
|
from pycs.jobs.JobGroupBusyException import JobGroupBusyException
|
|
|
from pycs.util import Callbacks
|
|
|
from pycs.util import GreenWorker
|
|
@@ -27,7 +27,6 @@ class JobRunner(GreenWorker, Singleton):
|
|
|
run jobs in a thread pool, but track progress and process results in eventlet queue
|
|
|
"""
|
|
|
|
|
|
-
|
|
|
""" Because it is a singleton (as described here:
|
|
|
https://www.python.org/download/releases/2.2/descrintro/
|
|
|
__init__ is called every time the singleton object
|
|
@@ -59,14 +58,14 @@ class JobRunner(GreenWorker, Singleton):
|
|
|
self.on("remove", nm.remove("job"))
|
|
|
|
|
|
@classmethod
|
|
|
- def Run(cls, *args, **kwargs):
|
|
|
- cls().run(*args, **kwargs)
|
|
|
+ def run(cls, *args, **kwargs):
|
|
|
+ cls()._run(*args, **kwargs)
|
|
|
|
|
|
@classmethod
|
|
|
- def Remove(cls, *args, **kwargs):
|
|
|
- cls().remove(*args, **kwargs)
|
|
|
+ def remove(cls, *args, **kwargs):
|
|
|
+ cls()._remove(*args, **kwargs)
|
|
|
|
|
|
- def remove(self, id):
|
|
|
+ def _remove(self, id):
|
|
|
"""
|
|
|
remove a job using its unique id
|
|
|
|
|
@@ -78,13 +77,11 @@ class JobRunner(GreenWorker, Singleton):
|
|
|
if self.__jobs[i].finished is not None:
|
|
|
job = self.__jobs[i]
|
|
|
del self.__jobs[i]
|
|
|
-
|
|
|
- for callback in self.__remove_listeners:
|
|
|
- callback(job)
|
|
|
+ self.__listeners["remove"](job)
|
|
|
|
|
|
return
|
|
|
|
|
|
- def run(self,
|
|
|
+ def _run(self,
|
|
|
project: Project,
|
|
|
job_type: str,
|
|
|
name: str,
|