def __init__(self, config, agent_config): super().__init__(config=agent_config) if not (isinstance(config, dict) and all(section in config for section in ('integrator', 'config'))): raise ValueError('Configuration invalid / missing required section') # Whilst the integrator core requires particular configuration, top-level sections could be defined to provide # parameters specific to this integrator. self.__integrator = Integrator(config['integrator'], self.client, self) self.__assets = set() self.__config = config # data cache used to check that the asset has been changed or not before publishing the event self.__data_cache = get_cache(config, config_path='integrator.asset.cache.method') self.__use_mock_data = NestedConfig.get(self.__config, 'config.use_mock_data', required=False, default=False) self.__workers = NestedConfig.get(self.__config, 'config.workers', required=False, default=1, check=non_negative_int) self.__loop_time = NestedConfig.get(self.__config, 'config.loop_time', required=False, default=5, check=non_negative_int) self.__req_pool = ThreadPoolExecutor(max_workers=self.__workers) self.__talend_config_info = TalendConfig( endpoint=NestedConfig.get(self.__config, 'config.talend.endpoint', required=True, check=non_empty_str), endpoint_single=NestedConfig.get(self.__config, 'config.talend.endpoint_single', required=True, check=non_empty_str), usr=NestedConfig.get(self.__config, 'config.talend.usr', required=True, check=non_empty_str), pwd=NestedConfig.get(self.__config, 'config.talend.pwd', required=True, check=non_empty_str), timeout=int(NestedConfig.get(self.__config, 'config.talend.timeout', required=False, default=10, check=non_negative_int)) )
def __init__(self, config, agent_config): super().__init__(config=agent_config) if not (isinstance(config, dict) and all(section in config for section in ('integrator', 'config'))): raise ValueError( 'Configuration invalid / missing required section') # Whilst the integrator core requires particular configuration, top-level sections could be defined to provide # parameters specific to this integrator. self.__integrator = Integrator(config['integrator'], self.client, self) self.__assets = set() self.__config = config # data cache used to check that the asset has been changed or not before publishing the event self.__data_cache = get_cache(config, config_path='integrator.asset.cache.method') self.__loop_time = NestedConfig.get(self.__config, 'config.loop_time', required=False, default=False) self.__sap_config_info = SapConfig( hi_endp=NestedConfig.get( self.__config, 'config.sap.hierarchy_endpoint', required=True, check=non_empty_str ), md_endp=NestedConfig.get( self.__config, 'config.sap.master_endpoint', required=True, check=non_empty_str ), md_usr=NestedConfig.get( self.__config, 'config.sap.usr', required=True, check=non_empty_str ), md_pwd=NestedConfig.get( self.__config, 'config.sap.pwd', required=True, check=non_empty_str ), md_timeout=int(NestedConfig.get( self.__config, 'config.sap.timeout', required=False, default=10, check=non_negative_int )) )
def __init__(self, config, fd_config, client, callbacks, fd_client=None): """ config - base integrator config fd_config - field data integrator specific configuration client - agent instance, as with base Integrator callbacks - instance of FdIntegratorCallbacks fd_client - additional agent to use for handling field data things, e.g under different owner. Defaults to `client` if not specified. """ super().__init__(config, client, self._Callbacks(self)) if not isinstance(callbacks, FdIntegratorCallbacks): raise TypeError('callbacks') self.__callbacks = callbacks if fd_client: if not isinstance(fd_client, Client): raise TypeError('client') self.__client = fd_client else: # already checked by parent __init__ self.__client = client self.__lock = Lock() self.__thing_details = _ThingDetails.from_config(fd_config) self.__cache = get_cache(fd_config, config_path='asset.cache.method') # Mapping of asset id to feed. Values can be None if feed is being initialised self.__feeds = {}
def __init__(self, config, agent_config): super().__init__(config=agent_config) if not (isinstance(config, Mapping) and all(section in config for section in ('integrator', 'config'))): raise ValueError( 'Configuration invalid / missing required section') # parameters specific to this integrator. self.__integrator = Integrator(config['integrator'], self.client, self) self.__assets = set() self.__config = config # data cache used to check that the asset has been changed or not before publishing the event self.__data_cache = get_cache( self.__config, config_path='integrator.asset.cache.method') # Pool of workers to execture type2 requests workers = NestedConfig.get(self.__config, 'config.workers', required=False, default=1, check=non_negative_int) self.__req_pool = ThreadPoolExecutor(max_workers=workers) # Validate config self.__sap_config_info = SapConfig( eq_hist_endp=NestedConfig.get( self.__config, 'config.sap.equipment_history_endpoint', required=True, check=non_empty_str), eq_doc_endp=NestedConfig.get( self.__config, 'config.sap.equipment_document_endpoint', required=True, check=non_empty_str), eq_doc_single=NestedConfig.get( self.__config, 'config.sap.equipment_document_single', required=True, check=non_empty_str), eq_doc_test=NestedConfig.get(self.__config, 'config.sap.equipment_document_test', required=True, check=non_empty_str), usr=NestedConfig.get(self.__config, 'config.sap.usr', required=True, check=non_empty_str), pwd=NestedConfig.get(self.__config, 'config.sap.pwd', required=True, check=non_empty_str), timeout=int( NestedConfig.get(self.__config, 'config.sap.timeout', required=False, default=10, check=non_negative_int)))
def __init__(self, config, agent_config): super().__init__(config=agent_config) if not (isinstance(config, dict) and all(section in config for section in ('integrator', 'config'))): raise ValueError( 'Configuration invalid / missing required section') # Whilst the integrator core requires particular configuration, top-level sections could be defined to provide # parameters specific to this integrator. self.__integrator = Integrator(config['integrator'], self.client, self) self.__assets = set() self.__config = config # data cache used to check that the asset has been changed or not before publishing the event self.__data_cache = get_cache(config, config_path='integrator.asset.cache.method')