client package

client.BaseReader module

class client.BaseReader.BaseReader(filepath)

Bases: abc.ABC

An abstract base class for all the reader classes. Custom readers must extend this class. Supported formats must be specified as class variable

__abstractmethods__ = frozenset({'__iter__', '__next__', 'get_user_binary'})
__dict__ = mappingproxy({'__module__': 'client.BaseReader', '__doc__': '\n An abstract base class for all the reader classes. Custom readers must extend this class.\n Supported formats must be specified as class variable\n ', 'supported_formats': (), '__init__': <function BaseReader.__init__>, 'get_user_binary': <function BaseReader.get_user_binary>, '__iter__': <function BaseReader.__iter__>, '__next__': <function BaseReader.__next__>, '__dict__': <attribute '__dict__' of 'BaseReader' objects>, '__weakref__': <attribute '__weakref__' of 'BaseReader' objects>, '__abstractmethods__': frozenset({'__iter__', '__next__', 'get_user_binary'}), '_abc_impl': <_abc_data object>})
__init__(filepath)

Initializes a reader instance that reads from the given file

Parameters

filepath – The path to the file being read

abstract __iter__()

The class must be an iterable that iterates over the snapshots from the file being read

__module__ = 'client.BaseReader'
abstract __next__()

Gets the next snapshot binary in the file according to cortex.proto

Returns

(string) A binary serialized snapshot string

__weakref__

list of weak references to the object (if defined)

abstract get_user_binary()

A method to get the user binary encoded according to cortex.proto

Returns

(string) A binary serialized user info string

supported_formats = ()

client.MindFileReader module

class client.MindFileReader.MindFileReader(filepath)

Bases: client.BaseReader.BaseReader

MindFileReader is a reader that reads from .mind and .mind.gz files

get_user_binary()

A method to get the user binary encoded according to cortex.proto

Returns

(string) A binary serialized user info string

client.client module

client.client.upload_sample(path, host='127.0.0.1', port=8000, *, reader=<class 'client.MindFileReader.MindFileReader'>)

Reads a sample file and uploads all the snapshots in it to the cortex.server instance

Parameters
  • path – The path to the sample file

  • host – The host of the cortex.server instance

  • port – The port of the cortex.server instance

  • reader – An optional reader class in case you want to read from a differently formatted file. See BaseReader doc.

Module contents

cortex.client submodule is responsible for reading sample files and uploading them to cortex.server

CLI

python -m cortex.client

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

upload-sample

Uploads the snapshot in the given sample file to the server. Supports only .mind and .mind.gz files

python -m cortex.client upload-sample [OPTIONS] PATH

Options

-h, --host <host>

The host of the cortex.server endpoint

-p, --port <port>

The port of the cortex.server endpoint

Arguments

PATH

Required argument