diff --git a/server/.settings/org.eclipse.core.resources.prefs b/server/.settings/org.eclipse.core.resources.prefs index f61c888f9..9027b52cf 100644 --- a/server/.settings/org.eclipse.core.resources.prefs +++ b/server/.settings/org.eclipse.core.resources.prefs @@ -21,10 +21,10 @@ encoding//src/uds/auths/InternalDB/Authenticator.py=utf-8 encoding//src/uds/auths/InternalDB/__init__.py=utf-8 encoding//src/uds/auths/RegexLdap/Authenticator.py=utf-8 encoding//src/uds/auths/RegexLdap/__init__.py=utf-8 -encoding//src/uds/auths/SAML-enterprise/SAML.py=utf-8 -encoding//src/uds/auths/SAML-enterprise/__init__.py=utf-8 encoding//src/uds/auths/SAML/SAML.py=utf-8 encoding//src/uds/auths/SAML/__init__.py=utf-8 +encoding//src/uds/auths/SAML_enterprise/SAML.py=utf-8 +encoding//src/uds/auths/SAML_enterprise/__init__.py=utf-8 encoding//src/uds/auths/Sample/SampleAuth.py=utf-8 encoding//src/uds/auths/Sample/__init__.py=utf-8 encoding//src/uds/auths/SimpleLDAP/Authenticator.py=utf-8 @@ -115,9 +115,6 @@ encoding//src/uds/services/Sample/SampleService.py=utf-8 encoding//src/uds/services/Sample/SampleUserDeploymentOne.py=utf-8 encoding//src/uds/services/Sample/SampleUserDeploymentTwo.py=utf-8 encoding//src/uds/services/Sample/__init__.py=utf-8 -encoding//src/uds/services/Vmware-enterprise/ServiceProviderVC.py=utf-8 -encoding//src/uds/services/Vmware-enterprise/VCLinkedCloneService.py=utf-8 -encoding//src/uds/services/Vmware-enterprise/__init__.py=utf-8 encoding//src/uds/services/Vmware/Helpers.py=utf-8 encoding//src/uds/services/Vmware/PublicationVC.py=utf-8 encoding//src/uds/services/Vmware/ServiceProviderVC.py=utf-8 @@ -129,6 +126,9 @@ encoding//src/uds/services/Vmware/client/Exceptions.py=utf-8 encoding//src/uds/services/Vmware/client/Server.py=utf-8 encoding//src/uds/services/Vmware/client/Task.py=utf-8 encoding//src/uds/services/Vmware/client/ws/VimService_types.py=utf-8 +encoding//src/uds/services/Vmware_enterprise/ServiceProviderVC.py=utf-8 +encoding//src/uds/services/Vmware_enterprise/VCLinkedCloneService.py=utf-8 +encoding//src/uds/services/Vmware_enterprise/__init__.py=utf-8 encoding//src/uds/services/__init__.py=utf-8 encoding//src/uds/tests.py=utf-8 encoding//src/uds/transports/NX/NXTransport.py=utf-8 diff --git a/server/src/uds/core/__init__.py b/server/src/uds/core/__init__.py index 3dfd51728..7447ff0de 100644 --- a/server/src/uds/core/__init__.py +++ b/server/src/uds/core/__init__.py @@ -43,6 +43,6 @@ import transports def __init__(): from managers.TaskManager import TaskManager - TaskManager.registerScheduledTask() + TaskManager.registerScheduledTasks() __init__() \ No newline at end of file diff --git a/server/src/uds/core/jobs/Scheduler.py b/server/src/uds/core/jobs/Scheduler.py index 63ffaa94e..ebcbc1a35 100644 --- a/server/src/uds/core/jobs/Scheduler.py +++ b/server/src/uds/core/jobs/Scheduler.py @@ -35,7 +35,7 @@ from django.db.models import Q from django.db import transaction, DatabaseError from uds.models import Scheduler as dbScheduler, getSqlDatetime, State from uds.core.jobs.JobsFactory import JobsFactory -from datetime import datetime, timedelta +from datetime import timedelta from socket import gethostname import threading, time import logging diff --git a/server/src/uds/core/managers/TaskManager.py b/server/src/uds/core/managers/TaskManager.py index 7ccfc7c10..20495d353 100644 --- a/server/src/uds/core/managers/TaskManager.py +++ b/server/src/uds/core/managers/TaskManager.py @@ -30,13 +30,12 @@ ''' @author: Adolfo Gómez, dkmaster at dkmon dot com ''' -from django.db import transaction from uds.core.jobs.Scheduler import Scheduler from uds.core.jobs.DelayedTaskRunner import DelayedTaskRunner -from uds.core.jobs.JobsFactory import JobsFactory +from uds.core import jobs from uds.core.util.Config import GlobalConfig import threading, time, signal -import logging, gc +import logging logger = logging.getLogger(__name__) @@ -71,9 +70,13 @@ class TaskManager(object): logger.info("Caught term signal, finishing task manager") TaskManager.keepRunning = False + @staticmethod + def registerJob(jobName, jobType): + jobs.factory().insert(jobName, jobType) + @staticmethod - def registerScheduledTask(): + def registerScheduledTasks(): from uds.core.workers.ServiceCacheUpdater import ServiceCacheUpdater from uds.core.workers.UserServiceCleaner import UserServiceInfoItemsCleaner, UserServiceRemover from uds.core.workers.PublicationCleaner import PublicationInfoItemsCleaner, PublicationCleaner @@ -81,14 +84,14 @@ class TaskManager(object): from uds.core.workers.DeployedServiceCleaner import DeployedServiceInfoItemsCleaner, DeployedServiceRemover logger.info("Registering sheduled tasks") - JobsFactory.factory().insert('Service Cache Updater', ServiceCacheUpdater) - JobsFactory.factory().insert('User Service Info Cleaner', UserServiceInfoItemsCleaner) - JobsFactory.factory().insert('User Service Cleaner', UserServiceRemover) - JobsFactory.factory().insert('Publications Info Cleaner', PublicationInfoItemsCleaner) - JobsFactory.factory().insert('Publication Cleaner', PublicationCleaner) - JobsFactory.factory().insert('Utility Cache Cleaner', CacheCleaner) - JobsFactory.factory().insert('Deployed Service Info Cleaner', DeployedServiceInfoItemsCleaner) - JobsFactory.factory().insert('Deployed Service Cleaner', DeployedServiceRemover) + TaskManager.registerJob('Service Cache Updater', ServiceCacheUpdater) + TaskManager.registerJob('User Service Info Cleaner', UserServiceInfoItemsCleaner) + TaskManager.registerJob('User Service Cleaner', UserServiceRemover) + TaskManager.registerJob('Publications Info Cleaner', PublicationInfoItemsCleaner) + TaskManager.registerJob('Publication Cleaner', PublicationCleaner) + TaskManager.registerJob('Utility Cache Cleaner', CacheCleaner) + TaskManager.registerJob('Deployed Service Info Cleaner', DeployedServiceInfoItemsCleaner) + TaskManager.registerJob('Deployed Service Cleaner', DeployedServiceRemover) diff --git a/server/src/uds/core/managers/__init__.py b/server/src/uds/core/managers/__init__.py index 87f24d207..e4d484ed2 100644 --- a/server/src/uds/core/managers/__init__.py +++ b/server/src/uds/core/managers/__init__.py @@ -37,3 +37,12 @@ def cryptoManager(): from CryptoManager import CryptoManager return CryptoManager.manager() + +def taskManager(): + from TaskManager import TaskManager + return TaskManager + + +def downloadsManager(): + from DownloadsManager import DownloadsManager + return DownloadsManager.manager()