def log_setLevel(self, level): """ Local override of log_setLevel fo handing the propagation of the level setting to the child service objects.""" Loggable.log_setLevel(self, level) for so in [ o for o in self._objects if isinstance(o, Loggable) and o is not self ]: so.log_setLevel(level)
def __init__(self, channel, dao): #pylint: disable=E1002 """ :param str channel: the event channel """ super(EventDatabaseObject, self).__init__() self._channel = channel self._dao = dao Loggable.__init__(self, logname='SO:%s' % self._channel)
def __init__(self, channel): """ :param str channel: the event channel """ super(EventManagerObject, self).__init__() self._emitLock = threading.Lock() self._channel = channel Loggable.__init__(self, logname='SO:%s' % self._channel)
def log_setLevel(self, level): """ Defines the logging level for the container and its service objects. :param level: logging level (see module :py:mod:`logging`) """ Loggable.log_setLevel(self, level) if self._polling_thread: self._polling_thread.log_setLevel(level) for haldev in (e.haldev for e in self._devices.itervalues() if isinstance(e.haldev, Loggable)): haldev.log_setLevel(self.log_getEffectiveLevel())
def __init__(self, owner): """ :param CoordinatorServiceObject owner: the owning coordinator """ threading.Thread.__init__(self) self._owner = owner self._serial_port = owner.serial_port self.name = 'ser-' + owner.coordinator_id self._terminate = False Loggable.__init__(self, logname='SerRX:%s' % owner.coordinator_id)
def __init__(self, rules=None): """ Initializes the rules list by compiling their specifications. :param rules: optional rules list :raises ValueError: if invalid regex, or if the topic format contains replaceable parameters not found in the regex """ Loggable.__init__(self) # cache for speeding up computations self._cache = {} # filtering and transformation transformation rules self.rules = rules[:] if rules else []
def __init__(self, owner, tasks): """ :param CoordinatorServiceObject owner: the coordinator in charge of the polling tasks :param tasks: the list of tasks corresponding to polling actions to be managed """ threading.Thread.__init__(self) self._owner = owner self._tasks = tasks self._terminate = False self._task_trigger_checking_period = self.DFLT_TASK_CHECKING_PERIOD self._stats_file_path = self.STATS_STORAGE_PATH % self._owner.coordinator_id Loggable.__init__(self, logname='Poll:%s' % self._owner.coordinator_id)
def __init__(self, cid): """ :param str cid: coordinator id """ dbus.service.Object.__init__(self) self._cid = cid self._cfg = None self._evtmgr = None self._polling_thread = None self._poll_req_interval = None self._devices = {} self._error_count = 0 Loggable.__init__(self, logname='%s' % str(self))
def __init__(self, cfg): """ The service object is configured based on the content of the configuration data, provided as a dictionary by the process which instantiates it. See :py:meth:`configure` method documentation for specifications of the configuration data. Note that providing no filter at all is invalid, since it would make the gateway useless. :param dict cfg: the configuration data :raises ValueError: if both filters are unset """ super(MQTTGatewayServiceObject, self).__init__() Loggable.__init__(self, logname='SO') self._lock = threading.Lock() self.configure(cfg, self.logger)
def __init__(self, name, conn=None, svc_objects=None, auto_fw_object=True): """ :param str name: the container's name. It is used to build the well-known name which will be claimed (see pycstbox.commons.make_bus_name()) :param dbus_connection conn: the connection to the bus used by the service. Set to the session bus if not provided. :param list svc_objects: an optional list of service objects, which will be automatically added to the container during its initialization. The items of this list are tuples containing the service object instance and the path to be associated for it :param bool auto_fw_object: if True (the default) a service object implementing framework level functions is automatically created and added. If False, it is the responsibility of the application to provide it and adding it if framework level functions are required. """ self._name = name self._conn = conn if conn else dbus.SessionBus() self._objects = [] # claim our "well known" name on the conn self._wkn = dbus.service.BusName(dbuslib.make_bus_name(name), self._conn) self._loop = None self._terminate_lock = threading.Lock() Loggable.__init__(self, logname='SC:%s' % self._name) # adds a service controller object if asked for if auto_fw_object: fwobj = _FrameworkServiceObject(self) self.add(fwobj, SYSTEM_OBJECT_PATH) # add provided service objects self.add_objects(svc_objects)
def __init__(self, port, unit_id, logname, retries=DEFAULT_RETRIES): """ :param str port: serial port on which the RS485 interface is connected :param int unit_id: the address of the device :param str logname: the (short) root for the name of the log :param int retries: number of retries in case of communication errors """ super(RTUModbusHWDevice, self).__init__(port=port, slaveaddress=int(unit_id)) self._first_poll = True self.poll_req_interval = 0 self.retries = retries self.terminate = False self.communication_error = False self.total_reads = 0 self.total_errors = 0 Loggable.__init__(self, logname='%s-%03d' % (logname, self.unit_id)) self.log_info('created %s instance with unit id=%d on port %s', self.__class__.__name__, unit_id, port)
def __init__(self, rules=None): """ Initializes the rules list by compiling their specifications. The specifications are provided as an iterable of 3 parts tuples, which items are : - a string containing the regex to be applied to fully qualified variable names, which can contain capture groups intended to be used for the topic string expansion - the MQTT topic string (or topic format string) to be used for publication - the callable used to build the MQTT message payload :param rules: an iterable of tuples, as described above :param logger: optional logging object :raises ValueError: if invalid regex, or if the topic format contains replaceable parameters not found in the regex """ Loggable.__init__(self) # cache for speeding up computations self._cache = {} # filtering and transformation rules self.rules = rules or []
def __init__(self, jobname, jobid, parms, logger=None): """ :param str jobname: job name (should be unique across the application) :param str jobid: the job id. Must be unique and allow sorting a job list and reflect their chronology :param parms: the execution parameters :param logger: (optional) message logger :raises ValueError: if mandatory parameters are not all non empty """ if not jobname or not jobid or parms is None: raise ValueError("missing mandatory parameter") self._name = jobname Loggable.__init__(self, logname=jobname) self._id = jobid self._parms = parms self._error = None self.log_info('- job %s:%s created :', jobname, jobid) self.log_info(' + parameters : %s', self._format_parms())
def __init__(self): Loggable.__init__(self, logname='evt-expproc') self._failed_jobs = {}
def log_setLevel(self, level): """ Local override of log_setLevel fo handing the propagation of the level setting to the child service objects.""" Loggable.log_setLevel(self, level) for so in [o for o in self._objects if isinstance(o, Loggable) and o is not self]: so.log_setLevel(level)
def __init__(self, logger, *args, **kwargs): Loggable.__init__(self, logger) self.log_warning('using a simulated connector') mqtt_client.Client.__init__(self, *args, **kwargs)
def __init__(self, port, unit_id): self._first_poll = True self.url = port self.address = int(unit_id) Loggable.__init__(self, logname='zwave%03d' % self.address)
def __init__(self): Loggable.__init__(self, logname='cfg-proc') self.data = None
def __init__(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) Loggable.__init__(self)
def __init__(self): Loggable.__init__(self, logname='cfg-expproc')