Skip to content
Snippets Groups Projects

Deliver notification info

Merged Adham Hashibon requested to merge deliver-to-ui into master

Created by: stefanoborini

Notification system to communicate to the UI and other entities interested in notification.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
81
82 return listeners
83
84 def _finalize_listener(self, listener):
85 """Helper method. Finalizes a listener and handles possible
86 exceptions. it does _not_ remove the listener from the listener
87 list.
88 """
89 try:
90 listener.finalize()
91 except Exception as e:
92 log.error(
93 "Exception while finalizing listener {}: {}".format(
94 listener.__class__.__name__,
95 str(e)
96 ))
  • Created by: martinRenou

    Should we not remove the listener from the list of listeners if it failed to finalize ? At this point we can not do anything for this listener..

  • Adham Hashibon
    Adham Hashibon @has started a thread on commit 8c751d84
  • 1 from traits.api import String
    2
    3 from force_bdss.api import (
    4 factory_id,
    5 BaseNotificationListenerFactory)
    6
    7 from .dummy_notification_listener import DummyNotificationListener
    8 from .dummy_notification_listener_model import DummyNotificationListenerModel
    9
    10
    11 class DummyNotificationListenerFactory(BaseNotificationListenerFactory):
    12 id = String(factory_id("enthought", "dummy_notification_listener"))
    13
    14 name = String("Dummy Notification Listener")
    15
    16 def create_model(self, model_data=None):
    • Created by: martinRenou

      Why don't we set the default value of model_data to {} directly instead of checking if it's None and if it's the case then set it to {} ?

  • Adham Hashibon
    Adham Hashibon @has started a thread on commit 8c751d84
  • 18 Notification engine for the UI. Uses zeromq for the traffic handling.
    19 """
    20 #: The ZMQ context. If None, it means that the service is unavailable.
    21 _context = Instance(zmq.Context)
    22
    23 #: The pubsub socket.
    24 _pub_socket = Instance(zmq.Socket)
    25
    26 #: The synchronization socket to communicate with the server (UI)
    27 _sync_socket = Instance(zmq.Socket)
    28
    29 #: Unique identifier from the UI. To be returned in the protocol.
    30 _identifier = String()
    31
    32 #: The protocol version that this plugin delivers
    33 _proto_version = "1"
  • Adham Hashibon
    Adham Hashibon @has started a thread on commit 8c751d84
  • 5 """Base event for the MCO"""
    6
    7
    8 class MCOStartEvent(BaseMCOEvent):
    9 """MCO should emit this event when the evaluation starts."""
    10
    11
    12 class MCOFinishEvent(BaseMCOEvent):
    13 """MCO should emit this event when the evaluation ends."""
    14
    15
    16 class MCOProgressEvent(BaseMCOEvent):
    17 """MCO should emit this event for every new evaluation that has been
    18 completed. It carries data about the evaluation, specifically the
    19 input data (MCO parameter values) and the resulting output (KPIs)."""
    20 input = Tuple()
  • Adham Hashibon
  • Adham Hashibon
  • Adham Hashibon
  • Adham Hashibon
    Adham Hashibon @has started a thread on commit 8c751d84
  • 1 import logging
    2 from traits.api import Instance, String
    3
    4 from force_bdss.api import (
    5 BaseNotificationListener,
    6 MCOStartEvent,
    7 MCOFinishEvent,
    8 MCOProgressEvent
    9 )
    10
    11 import zmq
    12
    13 log = logging.getLogger(__name__)
    14
    15
    16 class UINotification(BaseNotificationListener):
    • Created by: martinRenou

      Shouldn't this be a plugin coming from the UI and be part of the force_wfmanager repo ?

  • Adham Hashibon
  • Please register or sign in to reply
    Loading