bexchange package

Subpackages

Submodules

bexchange.backend module

class bexchange.backend.Backend[source]

Bases: object

Backend interface

abstract get_auth_manager()[source]

Returns the auth manager :return the auth manager

abstract get_storage_manager()[source]

Returns the storage manager :return the storage manager

abstract get_tmp_folder()[source]

Returns the global temporary folder name if defined :return the temporary folder name

abstract metadata_from_file(path)[source]

Parses a file and returns the metadata for this file. :param path: path to the file :type path: string :return the metadata for this file

abstract post_message(json_message, node_name)[source]

ensures that a posted message arrives to interested parties :param json_message: The json message :type path: string :param nodename: The origin that sent the message

abstract store_file(path, nodename)[source]

store a file in the database :param path: path to the file :type path: string :param nodename: The origin that tries to store the file

exception bexchange.backend.DuplicateEntry[source]

Bases: Exception

thrown to indicate that an entry already exists

exception bexchange.backend.IntegrityError[source]

Bases: RuntimeError

thrown to indicate a conflict between resources

bexchange.client_main module

bexchange.client_main.extract_command(args)[source]
bexchange.client_main.read_config(conffile)[source]
bexchange.client_main.run()[source]

bexchange.config module

exception bexchange.config.Error[source]

Bases: Exception

base configuration error

class bexchange.config.Properties(values, prefix='')[source]

Bases: object

dictionary()[source]
Returns:

returns the internal dictionary

filter(prefix)[source]

apply a prefix to the key lookups

Parameters:

prefix – the prefix to apply

Returns:

a new Properties instance with the specified prefix

get(key, default=<object object>)[source]

get the value associated with the key

Parameters:
  • key – the key for which to look up the value

  • default – default value if the key is not found

Raise:

PropertyLookupError if the key is not found and no default value is provided.

get_boolean(key, default=<object object>)[source]

get boolean value associated with the key

Parameters:
  • key – the key for which to look up the value

  • default – default value if the key is not found. This can be any value, but when provided as a str, it is parsed as if read from the configuration, otherwise it is returned as it is.

Raise:

PropertyLookupError if the key is not found and no default value is provided.

get_full_key(key)[source]

get a full key corresponding to this ‘filtered’ key

get_int(key, default=<object object>)[source]

get int value associated with the key

Parameters:
  • key – the key for which to look up the value

  • default – default value if the key is not found. This can be any value, but when provided as a str, it is parsed as if read from the configuration, otherwise it is returned as it is.

  • sep – value separator

Raise:

PropertyLookupError if the key is not found and no default value is provided.

get_keys()[source]

get available keys

Returns:

list of keys matching for current prefix

get_list(key, default=<object object>, sep=' ')[source]

get list of values associated with the key

Parameters:
  • key – the key for which to look up the value

  • default – default value if the key is not found. This can be any value, but when provided as a str, it is parsed as if read from the configuration, otherwise it is returned as it is.

  • sep – value separator

Raise:

PropertyLookupError if the key is not found and no default value is provided.

classmethod load(path)[source]

Loads a property file :param path: the property file to read :return: a new Properties instance

property prefix
exception bexchange.config.PropertyLookupError[source]

Bases: Error

property not found

exception bexchange.config.PropertyValueError[source]

Bases: Error

invalid property value

bexchange.config_main module

bexchange.config_main.extract_command(args)[source]
bexchange.config_main.run()[source]

bexchange.exchange_optparse module

class bexchange.exchange_optparse.Option(*opts, **attrs)[source]

Bases: Option

TYPES = ('string', 'int', 'long', 'float', 'complex', 'choice', 'iso8601_datetime', 'list', 'path')
TYPE_CHECKER = {'choice': <function check_choice>, 'complex': <function check_builtin>, 'float': <function check_builtin>, 'int': <function check_builtin>, 'iso8601_datetime': <function check_iso8601_datetime>, 'list': <function check_list>, 'long': <function check_builtin>, 'path': <function check_path>}
bexchange.exchange_optparse.check_iso8601_datetime(option, opt, value)[source]
bexchange.exchange_optparse.check_list(option, opt, value)[source]
bexchange.exchange_optparse.check_path(option, opt, value)[source]
bexchange.exchange_optparse.create_parser(*args, **kw)[source]

create an option parser with a custom option class that supports the following extra options types:

  • iso8601_datetime - an ISO 8601 datetime

  • list - a comma separated list of strings

  • path - an absolute paths (relative paths are converted to absolute)

bexchange.odimutil module

class bexchange.odimutil.metadata_helper[source]

Bases: object

classmethod is_hdf5_file(filename)[source]
classmethod metadata_from_file(source_manager, hasher, path)[source]

creates metadata from the file :param path: full path to the file :returns the metadata

bexchange.server_main module

bexchange.server_main.add_loghandler(logger, handler, formatter=None)[source]
bexchange.server_main.configure_logging(opts, logtype, logfile, logid, level=20)[source]
bexchange.server_main.create_optparser()[source]
bexchange.server_main.excepthook(*exc_info)[source]
bexchange.server_main.get_logging_level(conf)[source]
bexchange.server_main.isprocessrunning(pid)[source]
bexchange.server_main.read_config(conffile)[source]
bexchange.server_main.run()[source]

bexchange.util module

class bexchange.util.abstractclassmethod(callable)[source]

Bases: classmethod

A decorator indicating abstract classmethods.

Similar to abstractmethod.

Usage:

class C(metaclass=ABCMeta):

@abstractclassmethod

def my_abstract_classmethod(cls, …):

bexchange.util.create_fileid_from_meta(meta)[source]
class bexchange.util.message_aware[source]

Bases: ABC

abstract handle_message(json_message, nodename)[source]

Implement to handle the json message :param json_message: The json message

Module contents