Esempio n. 1
0
    def __init__(self,
                 name="base-service",
                 directory_proxy=None,
                 parent_logger=None,
                 enable_service_recovery=False):
        """
        uuid - a uuid4 value for the service
        alias - a colloquial alias
        unique_name - a name which includes an easier to remember alias with the uuid

        :param name:
        :param directory_proxy:
        :param parent_logger:
        :return:
        """
        ErrorHandlerMixin.__init__(self)

        # time indexes
        self.time_starting_index = None  # time index when service was 'starting'
        self.time_started_index = None  # time index when service was started

        self.uuid = uuid4()  # unique uuid
        self.alias = name  # name, may collide
        self.unique_name = '%s/%s' % (
            self.alias, self.uuid
        )  # a unique name for this service, will always be unique
        scales.init(self, self.unique_name)

        if parent_logger is None:  # no parent, use fq name
            self.lineage = "%s" % self.unique_name
        else:
            parent_name = parent_logger._context["name"]
            self.lineage = "%s/%s" % (parent_name, self.unique_name)

        self.log = Logger.get_logger(self.lineage)
        self.greenlet = None
        self._service_state = None
        self.set_state(BaseStates.Idle)

        # directory service proxy
        self.directory_proxy = directory_proxy

        # service recovery option
        self.enable_service_recovery = enable_service_recovery

        self.log.debug("Initialized.")
Esempio n. 2
0
    def __init__(self,
                 name="base-service",
                 directory_proxy=None,
                 parent_logger=None,
                 enable_service_recovery=False):
        """
        uuid - a uuid4 value for the service
        alias - a colloquial alias
        unique_name - a name which includes an easier to remember alias with the uuid

        :param name:
        :param directory_proxy:
        :param parent_logger:
        :return:
        """
        ErrorHandlerMixin.__init__(self)

        # time indexes
        self.time_starting_index = None  # time index when service was 'starting'
        self.time_started_index = None  # time index when service was started

        self.uuid = uuid4()  # unique uuid
        self.alias = name  # name, may collide
        self.unique_name = '%s/%s' % (self.alias, self.uuid)  # a unique name for this service, will always be unique
        scales.init(self, self.unique_name)

        if parent_logger is None:  # no parent, use fq name
            self.lineage = "%s" % self.unique_name
        else:
            parent_name = parent_logger._context["name"]
            self.lineage = "%s/%s" % (parent_name, self.unique_name)

        self.log = Logger.get_logger(self.lineage)
        self.greenlet = None
        self._service_state = None
        self.set_state(BaseStates.Idle)

        # directory service proxy
        self.directory_proxy = directory_proxy

        # service recovery option
        self.enable_service_recovery = enable_service_recovery

        self.log.debug("Initialized.")
Esempio n. 3
0
 def __init__(self, alias):
     ExecutorService.__init__(self, alias)
     ErrorHandlerMixin.__init__(self)
 def __init__(self, alias):
     ExecutorService.__init__(self, alias)
     ErrorHandlerMixin.__init__(self)