code formatted

This commit is contained in:
Volkan Şahin 2016-08-10 12:33:21 +03:00
parent 6c54302c52
commit aa2023643f
2 changed files with 17 additions and 8 deletions

View file

@ -12,7 +12,6 @@ from base.messaging.AnonymousMessenger import AnonymousMessager
from base.system.system import System
from base.timer.setup_timer import SetupTimer
from base.timer.timer import Timer
from base.system.system import System
class Registration:

View file

@ -25,27 +25,37 @@ class TaskManager(object):
self.logger.debug('[TaskManager] Adding task ... ')
self.pluginManager.process_task(task)
else:
print(str(task.get_cron_str()))
self.scheduler.save_and_add_job(task)
except Exception as e:
self.logger.debug('[TaskManager] Exception occurred when adding task. Error Message: {}'.format(str(e)))
self.logger.debug('[TaskManager] Exception occurred when adding task. Error Message: {0}'.format(str(e)))
def addPolicy(self, policy):
try:
self.pluginManager.process_policy(policy)
except Exception as e:
self.logger.error("[TaskManager] Exception occurred when adding policy. Error Message: {}".format(str(e)))
self.logger.error("[TaskManager] Exception occurred when adding policy. Error Message: {0}".format(str(e)))
def saveTask(self, task):
try:
task_cols = ['id', 'create_date', 'modify_date', 'command_cls_id', 'parameter_map', 'deleted', 'plugin', 'cron_expr', 'file_server']
plu_cols = ['active', 'create_date', 'deleted', 'description', 'machine_oriented', 'modify_date', 'name', 'policy_plugin', 'user_oriented', 'version', 'task_plugin', 'x_based']
plugin_args = [str(task.get_plugin().get_active()), str(task.get_plugin().get_create_date()), str(task.get_plugin().get_deleted()), str(task.get_plugin().get_description()), str(task.get_plugin().get_machine_oriented()), str(task.get_plugin().get_modify_date()), str(task.get_plugin().get_name()), str(task.get_plugin().get_policy_plugin()), str(task.get_plugin().get_user_oriented()), str(task.get_plugin().get_version()), str(task.get_plugin().get_task_plugin()), str(task.get_plugin().get_x_based())]
task_cols = ['id', 'create_date', 'modify_date', 'command_cls_id', 'parameter_map', 'deleted', 'plugin',
'cron_expr', 'file_server']
plu_cols = ['active', 'create_date', 'deleted', 'description', 'machine_oriented', 'modify_date', 'name',
'policy_plugin', 'user_oriented', 'version', 'task_plugin', 'x_based']
plugin_args = [str(task.get_plugin().get_active()), str(task.get_plugin().get_create_date()),
str(task.get_plugin().get_deleted()), str(task.get_plugin().get_description()),
str(task.get_plugin().get_machine_oriented()), str(task.get_plugin().get_modify_date()),
str(task.get_plugin().get_name()), str(task.get_plugin().get_policy_plugin()),
str(task.get_plugin().get_user_oriented()), str(task.get_plugin().get_version()),
str(task.get_plugin().get_task_plugin()), str(task.get_plugin().get_x_based())]
plugin_id = self.db_service.update('plugin', plu_cols, plugin_args)
values = [str(task.get_id()), str(task.get_create_date()), str(task.get_modify_date()), str(task.get_command_cls_id()), str(task.get_parameter_map()), str(task.get_deleted()), str(plugin_id), str(task.get_cron_str()), str(task.get_file_server())]
values = [str(task.get_id()), str(task.get_create_date()), str(task.get_modify_date()),
str(task.get_command_cls_id()), str(task.get_parameter_map()), str(task.get_deleted()),
str(plugin_id), str(task.get_cron_str()), str(task.get_file_server())]
self.db_service.update('task', task_cols, values)
except Exception as e:
self.logger.error("[TaskManager] Exception occurred while saving task. Error Message: {}".format(str(e)))
self.logger.error("[TaskManager] Exception occurred while saving task. Error Message: {0}".format(str(e)))
def updateTask(self, task):
# TODO not implemented yet