def disconnect(self): try: self._disconnect(self) except: pmnc.log.error(exc_string()) # log and ignore finally: TransactionalResource.disconnect(self)
def disconnect(self): try: try: self._sync_adapter_command("EXIT") finally: self._stop_adapter(Timeout(min(5.0, pmnc.request.remain))) except: pmnc.log.error(exc_string()) # log and ignore finally: TransactionalResource.disconnect(self)
def __init__(self, name: str, *, server_address: (str, int), broadcast: bool): TransactionalResource.__init__(self, name) self._server_address = server_address self._broadcast = broadcast self._server_info = "{0:s} udp://{1[0]:s}:{1[1]:d}".\ format(name, self._server_address)
def connect(self): TransactionalResource.connect(self) self._socket = socket(AF_INET, SOCK_DGRAM) try: if self._broadcast: self._socket.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) else: self._socket.connect(self._server_address) except: self._socket.close() raise
def __init__(self, name: str, *, java: os_path.isfile, arguments: tuple_of(str), classpath: str, jndi: dict_of(str, str), factory: str, queue: str, username: str, password: str): TransactionalResource.__init__(self, name) AdapterHost.__init__(self, "org.pythomnic.jms.Sender", java = java, arguments = arguments, classpath = classpath, jndi = jndi, factory = factory, queue = queue, username = username, password = password) self._request_count = 0
def __init__(self, name: str, *, target_directory: optional(str) = None, temp_directory: optional(str) = None, temp_extension: str, file_permissions: by_regex("^(?:[r-][w-][x-]){3}$")): TransactionalResource.__init__(self, name) self._target_directory = target_directory self._temp_directory = temp_directory self._temp_suffix = ".{0:s}".format(temp_extension) self._perm_mask = 0 for i, perm_flag in enumerate((S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH)): if file_permissions[i] != "-": self._perm_mask |= perm_flag
def __init__(self, name: str, *, server_address: (str, int), connect_timeout: float, database: valid_database, username: optional(str) = None, password: optional(str) = None): TransactionalResource.__init__(self, name) self._server_address = server_address self._connect_timeout = connect_timeout self._database = database self._username = username self._connection = MongoDB_Connection(server_address=server_address, auth_database=database, username=username, password=password)
def __init__(self, name: str, *, source_addr_ton: byte, source_addr_npi: byte, source_addr: str, asynchronous: bool, pack_7bit: optional(bool) = None, frag_method: optional(one_of("sar", "udh")) = None): TransactionalResource.__init__(self, name) self._interface_name = name.split("/", 1)[0] self._source_addr_ton = source_addr_ton self._source_addr_npi = source_addr_npi self._source_addr = source_addr self._asynchronous = asynchronous self._pack_7bit = pack_7bit or False self._frag_method = frag_method self._interface = None
def __init__(self, name, *, server_address: (str, int), connect_timeout: float, ssl_key_cert_file: optional(os_path.isfile), ssl_ca_cert_file: optional(os_path.isfile), ssl_ciphers: optional(str) = None, ssl_protocol: optional( one_of("SSLv23", "TLSv1", "TLSv1_1", "TLSv1_2", "TLS")) = None, ssl_server_hostname: optional(str) = None, ssl_ignore_hostname: optional(bool) = False, extra_headers: dict_of(str, str), http_version: str, server_uri: str, request_encoding: str, allow_none: optional(bool) = False): TransactionalResource.__init__(self, name) self._server_uri = server_uri self._request_encoding = request_encoding self._allow_none = allow_none self._http_resource = \ pmnc.protocol_http.Resource(name, server_address = server_address, connect_timeout = connect_timeout, ssl_key_cert_file = ssl_key_cert_file, ssl_ca_cert_file = ssl_ca_cert_file, ssl_ciphers = ssl_ciphers, ssl_protocol = ssl_protocol, ssl_server_hostname = ssl_server_hostname, ssl_ignore_hostname = ssl_ignore_hostname, extra_headers = extra_headers, http_version = http_version)
def begin_transaction(self, *args, **kwargs): TransactionalResource.begin_transaction(self, *args, **kwargs) self._db = pmnc.state.default_state_db(self.source_module_name) self._txn, self._commit, self._rollback = \ pmnc.state.start_transaction(self.source_module_name)
def __init__(self, name: str, **config): TransactionalResource.__init__(self, name) self._connect = config.pop("connect", self._noop) self._disconnect = config.pop("disconnect", self._noop) self._config = config
def connect(self): TransactionalResource.connect(self) self._connect(self)
def _expired(self): return self._http_resource.expired or \ TransactionalResource._expired(self)
def _expired(self): return not self._adapter_running() or \ TransactionalResource._expired(self)
def connect(self): TransactionalResource.connect(self) self._interface = pmnc.interfaces.get_interface(self._interface_name) if self._interface is None: raise Exception("interface {0:s} is unavailable".format(self._interface_name))
def begin_transaction(self, *args, **kwargs): TransactionalResource.begin_transaction(self, *args, **kwargs) self._message_id = None
def disconnect(self): try: self._http_resource.disconnect() finally: TransactionalResource.disconnect(self)
def set_idle_timeout(self, idle_timeout): self._http_resource.set_idle_timeout(idle_timeout) TransactionalResource.set_idle_timeout(self, idle_timeout)
def _expired(self): return self._interface is None or self._interface.ceased or \ TransactionalResource._expired(self)
def connect(self): TransactionalResource.connect(self) self._attrs = [] self._http_resource.connect()
def connect(self): TransactionalResource.connect(self) connect_timeout = Timeout( min(self._connect_timeout, pmnc.request.remain)) self._connection.connect(connect_timeout) self._attrs = []
def connect(self): TransactionalResource.connect(self) self._start_adapter("resource instance", self.name, Timeout(pmnc.request.remain))
def disconnect(self): try: self._socket.close() finally: TransactionalResource.disconnect()
def reset_idle_timeout(self): self._http_resource.reset_idle_timeout() TransactionalResource.reset_idle_timeout(self)
def set_max_age(self, max_age): self._http_resource.set_max_age(max_age) TransactionalResource.set_max_age(self, max_age)
def begin_transaction(self, *args, **kwargs): TransactionalResource.begin_transaction(self, *args, **kwargs) self._db = pmnc.state.default_state_db(self.source_module_name) self._txn, self._commit, self._rollback = pmnc.state.start_transaction(self.source_module_name)
def begin_transaction(self, *args, **kwargs): TransactionalResource.begin_transaction(self, *args, **kwargs) self._temp_filename = None self._overwrite = self._remove = None