saver package

saver module

class mindreader.saver.saver.Saver(database_url)

Bases: object

run_all_savers(mq_url: str, debug: bool = False)

Runs the saver as a service, so it listens on the queue, and saves the data received to the database.

Parameters
  • mq_url – Receives a url to a message queue, and consumes data from all available parsers.

  • debug – if enabled, each data will be printed before saved to the database.

run_saver(topic: str, mq: mindreader.drivers.message_queues.message_queue.MessageQueue, debug=False)

Registers to a message queue on a single parser type, received snapshot parsing results, and saves them to the database.

Parameters
  • topic – The type of parsed data it consumes (user, pose, etc).

  • mq – A message queue. Note that it should already be initialized (not a url).

  • debug – if enabled, each data will be printed before saved to the database.

save(topic: str, data: str, debug: bool = False)

Saves data to the database.

Parameters
  • topic – The type of the data (user, pose, etc).

  • data – The data, in JSON format.

  • debug – if enabled, the data will be printed before saved to the database.

CLI

python -m mindreader.saver

python -m mindreader.saver [OPTIONS] COMMAND [ARGS]...

run-saver

python -m mindreader.saver run-saver [OPTIONS] DB_URL MQ_URL

Options

--debug, --no-debug

If enabled, the saver will print the data that it saves

Arguments

DB_URL

Required argument

MQ_URL

Required argument

save

python -m mindreader.saver save [OPTIONS] TOPIC PATH

Options

-d, --database <database>

Arguments

TOPIC

Required argument

PATH

Required argument