parsers package

parsers.run_parsers module

parsers.run_parsers.run_parser(field, data)

Runs the respective parser for the given field and data and returns the parsed result

Parameters
  • field – The field name to be parsed

  • data – A snapshot message as received from the message queue (json format by default)

Returns

(dict) The parsed result

parsers.run_parsers.run_parser_service(field, mq_url)

Runs a parser service that listens to a message queue, parses incoming messages and publishes back a message with parsed data

Parameters
  • field – The field name to be parsed

  • mq_url – The address of the message queue (+scheme) to connect and listen to. The MQ listener is determined by the scheme (see mq_listeners module)

Module contents

cortex.parsers is a submodule responsible for handling all the parsing of snapshots, storing parser classes and functions and running them as services

CLI

python -m cortex.parsers

python -m cortex.parsers [OPTIONS] COMMAND [ARGS]...

parse

Receives a field name and a path to a file with a message (as received from the message queue) and prints the parsed result

python -m cortex.parsers parse [OPTIONS] FIELD DATA_PATH

Arguments

FIELD

Required argument

DATA_PATH

Required argument

run-parser

Receives a field name and a url to a message queue (+scheme) and starts a service that listens to messages and sends back parsed data

python -m cortex.parsers run-parser [OPTIONS] FIELD MQ_URL

Arguments

FIELD

Required argument

MQ_URL

Required argument