mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-29 23:42:53 +03:00
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
#!/usr/bin/python3
|
|
# -*- coding: utf-8 -*-
|
|
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
|
from base.Scope import Scope
|
|
from base.model.MessageFactory import MessageFactory
|
|
from base.model.MessageType import MessageType
|
|
|
|
class TaskManager(object):
|
|
"""docstring for TaskManager"""
|
|
def __init__(self):
|
|
super(TaskManager, self).__init__()
|
|
scope = Scope.getInstance()
|
|
self.pluginManager = scope.getPluginManager()
|
|
self.logger= scope.getLogger()
|
|
self.dbService = scope.getDbService()
|
|
|
|
def addTask(self,task):
|
|
try:
|
|
self.logger.debug('Adding task ... ' + str(task.plugin_ame) + ' - ' + str(task.command_id))
|
|
self.saveTask(task)
|
|
# TODO send task received message
|
|
self.pluginManager.processTask(task)
|
|
except Exception as e:
|
|
# TODO error log here
|
|
pass
|
|
|
|
def saveTask(self,task):
|
|
# TODO not implemented yet
|
|
# task reveiced to ahenk save to db firstly.
|
|
# if user close before processing task you can load from db for process
|
|
pass
|
|
|
|
def updateTask(self,task):
|
|
# TODO not implemented yet
|
|
# This is updates task status processing - processed ...
|
|
pass
|
|
|
|
def deleteTask(self,task):
|
|
# TODO not implemented yet
|
|
# remove task if it is processed
|
|
pass
|
|
|
|
def sendMessage(self,type,message):
|
|
# TODO not implemented yet
|
|
pass
|
|
|
|
|
|
if __name__ == '__main__':
|
|
print(MessageFactory.createMessage(MessageType.TASK_PROCESSING,"my message"))
|