rixaplugin package

Subpackages

Submodules

rixaplugin.async_api module

Only here to prevent import errors. Not a real file.

API code is generated when plugin system is initialized. See api.BaseAPI for a list of all available functions.

rixaplugin.decorators module

rixaplugin.decorators.global_init()
rixaplugin.decorators.plugfunc(local_only: bool = False, tags: list | None = None)
rixaplugin.decorators.worker_init()

rixaplugin.settings module

rixaplugin.settings.ACCEPT_REMOTE_PLUGINS = 2

Whether or not to retrieve remote plugins. Usually set to true for servers and to false for clients. Only activate for clients when remote calling other plugins is required for your plugin code. 0: Deny, 1 Allow, 2 automatic

rixaplugin.settings.ALLOWED_PLUGIN_HOSTS = ['localhost']

List of domains which the plugin server serves. ‘*’ means all connections will be accepted.

rixaplugin.settings.ALLOW_NETWORK_RELAY = False

If there are servers A B and C, where B is this server, this setting controls if A can send messages to C through B, and vice versa. Usually this is only activated for the main server. This also controls whether this instance sends infos on connected plugins to newly connected instances. If activated on most/all servers, a decentralized system is possible (at cost of performance. Also kinda buggy as of now).

rixaplugin.settings.AUTO_APPLY_TAGS = []

List of tags-plugin pairs to be applied on startup. Will be applied last i.e. after connecting to other plugins. Does not apply to plugins that are manually imported or to connections that are manually established.

rixaplugin.settings.AUTO_CONNECTIONS = []

A list of addresses to which the plugin system will try to connect to on startup.

Format: “address:port-tag” The tag is optional and can be used to automatically assign the plugin to a certain group.aaa

rixaplugin.settings.AUTO_IMPORT_PLUGINS = []

List of plugins to be imported on startup from a package. Use the full path to the plugin e.g. for using the math plugin from rixaplugin.default_plugins use “rixaplugin.default_plugins.math”.

These plugins will all inherit the settings of the importing process.

rixaplugin.settings.AUTO_IMPORT_PLUGINS_PATHS = []

List of paths to be searched for plugins to be imported on startup.

Can point to a folder or a .py file. These plugins will all inherit the settings of the importing process.

rixaplugin.settings.CONSOLE_USE_COLORS = True

Wether to print in colors to console. On some systems that isn’t supported in which case you will get flooded with control sequences. Use this to deactivate colors in the console.

rixaplugin.settings.DEFAULT_MAX_WORKERS = 4

Default number of worker threads for a plugin server. This is the number of threads or processes that can execute plugin code.

rixaplugin.settings.DEFAULT_PLUGIN_SERVER_PORT = 15000

Default port on which the plugin server will listen.

rixaplugin.settings.DISABLED_LOGGERS = ['daphne.http_protocol', 'daphne.server', 'daphne.ws_protocol', 'openai', 'urllib3', 'matplotlib', 'sentence_transformers.SentenceTransformer', 'IPKernelApp', 'ipykernel', 'Comm', 'ipykernel.comm', 'httpcore', 'httpx', 'Comm']

Loggers that will be excluded on all outputs

rixaplugin.settings.FUNCTION_CALL_TIMEOUT = 60

Timeout for function calls in seconds. After this time an exception will be raised. Multiple occurences can lead to a plugin being marked as offline and hence be disabled.

Also: Try to avoid timing out. It potentially leads to a plethora of error messages as everything along the call chain will subsequently time out too. All intermediate instances may raise some sort of error.

rixaplugin.settings.LOG_FILE_TYPE = 'none'

Either none, html or txt. None means no log files are created. html supports color formatting while.

rixaplugin.settings.LOG_FMT = '%(asctime)s-%(name)s-%(levelname)s \'%(message)s\' (File "%(pathname)s", line %(lineno)d)'

Format to be used for logging. See https://docs.python.org/3/library/logging.html#logrecord-attributes There is an additional session_id attribute. It’s behaviour is defined by LOG_UID_MODE

rixaplugin.settings.LOG_PROCESSPOOL = False

If true this will write all processpool activity into WORKING_DIRECTORY/log/processpool.csv Specifically it will log when a new task is started and when it is finished. It will additionally add the current queue size and number of active workers.

rixaplugin.settings.LOG_REMOTE_EXCEPTIONS_LOCALLY = True

Log exceptions (that occurred locally) but are meant for remote plugins to the local log stream

rixaplugin.settings.MAX_LOG_SIZE = 200

Max file size in kb before new logfile will be created. Normally there are 2 backup logfiles. 1 kb~6-9 log messages for txt and ~4-7 for html

rixaplugin.settings.MAX_QUEUE_SIZE = 3

Maximum number of tasks in the worker pools. Submitting after will raise an exception.

rixaplugin.settings.OVERRIDE_FUNCTION_SCOPE = False

If true functions will always be available no matter what scope the API object has.

rixaplugin.settings.PLUGIN_DEFAULT_ADDRESS = 'localhost'

Default to which plugin system will connect/listen to. Not used outside of RIXA webserver or CLI.

rixaplugin.settings.PLUGIN_DEFAULT_PORT = 15000

Port to which plugin system will bind to by default. Not used outside of RIXA webserver or CLI.

rixaplugin.settings.REDIRECTED_LOGGERS = ['django.request', 'django.security', 'django.security.DisallowedHost', 'django.channels.server']

Loggers mentioned here will be sent to a separate file. Useful to e.g. separate django logs from plugin logs.

rixaplugin.settings.TMP_DATA_LOG_FOLDER = '/tmp/rixa_data_log'

Folder for api.datalog_to_tmp

rixaplugin.settings.VERBOSE_REQUEST_ID = False

Turns the request id from a hash to a readable string. This is useful for debugging but will lead to collisions.

rixaplugin.settings.logfile_path = 'log/main'

Where logfile is located. Without starting / it is considered relative to the working directory.

rixaplugin.sync_api module

Only here to prevent import errors. Not a real file.

API code is generated when plugin system is initialized. See api.BaseAPI for a list of all available functions.

Module contents

rixaplugin.execute(function_name, plugin_name=None, args=None, kwargs=None, timeout=30)

Execute a function in the plugin system synchronously i.e. wait for the result.

Parameters:
  • function_name

  • plugin_name

  • args

  • kwargs

  • timeout – Timeout in s before a TimeoutError is raised

Returns:

rixaplugin.execute_code(code, timeout=30)
rixaplugin.set_tags(plugin_name, tags)