1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Some more refactoring

This commit is contained in:
Adolfo Gómez 2012-07-31 10:42:30 +00:00
parent d90d9dfca7
commit bd81e83f7a
5 changed files with 31 additions and 19 deletions

View File

@ -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

View File

@ -43,6 +43,6 @@ import transports
def __init__():
from managers.TaskManager import TaskManager
TaskManager.registerScheduledTask()
TaskManager.registerScheduledTasks()
__init__()

View File

@ -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

View File

@ -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)

View File

@ -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()