Skip to content
Snippets Groups Projects
Commit 5bd131cb authored by Fabio Vitello's avatar Fabio Vitello
Browse files

TMSS-419: Connecting to MessageBus

First attempt to use the TMSSSubTaskEventMessageHandler to get onSubTaskDefined events
parent d752d08b
No related branches found
No related tags found
1 merge request!268Resolve TMSS-419
...@@ -14,6 +14,37 @@ from .. import viewsets ...@@ -14,6 +14,37 @@ from .. import viewsets
from viewflow import frontend, ThisObject from viewflow import frontend, ThisObject
from viewflow.activation import STATUS from viewflow.activation import STATUS
from lofar.sas.tmss.client.tmssbuslistener import *
class SchedulingUnitEventMessageHandler(TMSSSubTaskEventMessageHandler):
"""
def __init__(self, tmss_client_credentials_id: str=None):
super().__init__()
self.tmss_client = TMSSsession.create_from_dbcreds_for_ldap(tmss_client_credentials_id)
def start_handling(self):
self.tmss_client.open()
super().start_handling()
def stop_handling(self):
super().stop_handling()
self.tmss_client.close()
"""
def onSubTaskDefined(self, **kwargs):
logger.debug("MyTMSSSubTaskEventMessageHandler.onSubTaskDefined(%s)", kwargs)
def onSubTaskDefining(self, **kwargs):
logger.debug("MyTMSSSubTaskEventMessageHandler.onSubTaskDefining(%s)", kwargs)
"""
def onSubTaskDefined(self, subtask_id: int, old_state: str, new_state:str):
logger.debug("MyTMSSSubTaskEventMessageHandler.onSubTaskDefined)")
def onSubTaskDefining(self, subtask_id: int, old_state: str, new_state:str):
logger.debug("MyTMSSSubTaskEventMessageHandler.onSubTaskDefining")
"""
class ConditionActivation(FuncActivation): class ConditionActivation(FuncActivation):
@classmethod @classmethod
def activate(cls, flow_task, prev_activation, token): def activate(cls, flow_task, prev_activation, token):
...@@ -68,6 +99,7 @@ class Condition(Signal): ...@@ -68,6 +99,7 @@ class Condition(Signal):
@frontend.register @frontend.register
class SchedulingUnitFlow(Flow): class SchedulingUnitFlow(Flow):
process_class = models.SchedulingUnitProcess process_class = models.SchedulingUnitProcess
TMSSSubTaskBusListener(handler_type=SchedulingUnitEventMessageHandler)
start = ( start = (
flow.StartSignal( flow.StartSignal(
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
from django.db.models import CharField, IntegerField,BooleanField, ForeignKey, CASCADE, Model,NullBooleanField from django.db.models import CharField, IntegerField,BooleanField, ForeignKey, CASCADE, Model,NullBooleanField
from viewflow.models import Process from viewflow.models import Process
from lofar.sas.tmss.client.tmssbuslistener import *
class QAReportingTO(Model): class QAReportingTO(Model):
operator_report = CharField(max_length=150) operator_report = CharField(max_length=150)
operator_accept = BooleanField(default=False) operator_accept = BooleanField(default=False)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment