synapse.cmds package

Submodules

synapse.cmds.boss module

class synapse.cmds.boss.KillCmd(cli, **opts)[source]

Bases: Cmd

Kill a running task/query within the cortex.

Syntax:

kill <iden>

Users may specify a partial iden GUID in order to kill exactly one matching process based on the partial guid.

async runCmdOpts(opts)[source]

Perform the command actions. Must be implemented by Cmd implementers.

Parameters:

opts (dict) – Options dictionary.

class synapse.cmds.boss.PsCmd(cli, **opts)[source]

Bases: Cmd

List running tasks in the cortex.

async runCmdOpts(opts)[source]

Perform the command actions. Must be implemented by Cmd implementers.

Parameters:

opts (dict) – Options dictionary.

synapse.cmds.cortex module

class synapse.cmds.cortex.Log(cli, **opts)[source]

Bases: Cmd

Add a storm log to the local command session.

Notes

By default, the log file contains all messages received from the execution of a Storm query by the current CLI. By default, these messages are saved to a file located in ~/.syn/stormlogs/storm_(date).(format).

Examples

# Enable logging all messages to mpk files (default) log –on

# Disable logging and close the current file log –off

# Enable logging, but only log edits. Log them as jsonl instead of mpk. log –on –edits-only –format jsonl

# Enable logging, but log to a custom path: log –on –path /my/aweome/log/directory/storm20010203.mpk

# Log only the node messages which come back from a storm cmd execution. log –on –nodes-only –path /my/awesome/log/directory/stormnodes20010203.mpk

closeLogFd()[source]
encodeMsg(mesg)[source]

Get byts for a message

onStormMesg(mesg)[source]
openLogFd(opts)[source]
queueLoop()[source]
async runCmdOpts(opts)[source]

Perform the command actions. Must be implemented by Cmd implementers.

Parameters:

opts (dict) – Options dictionary.

save(mesg)[source]
class synapse.cmds.cortex.StormCmd(cli, **opts)[source]

Bases: Cmd

Execute a storm query.

Syntax:

storm <query>

Parameters:

query – The storm query

Optional Arguments:

–hide-tags: Do not print tags. –hide-props: Do not print secondary properties. –hide-unknown: Do not print messages which do not have known handlers. –show-nodeedits: Show full nodeedits (otherwise printed as a single . per edit). –editformat <format>: What format of edits the server shall emit.

Options are
  • nodeedits (default),

  • count (just counts of nodeedits), or

  • none (no such messages emitted).

–show-prov: Show provenance messages. –raw: Print the nodes in their raw format. This overrides –hide-tags and –hide-props. –debug: Display cmd debug information along with nodes in raw format. This overrides other display arguments. –path: Get path information about returned nodes. –show <names>: Limit storm events (server-side) to the comma-separated list. –file <path>: Run the storm query specified in the given file path. –optsfile <path>: Run the query with the given options from a JSON/YAML file.

Examples

storm inet:ipv4=1.2.3.4 storm –debug inet:ipv4=1.2.3.4

editformat_enums = ('nodeedits', 'count', 'none')
printf(mesg, addnl=True, color=None)[source]
async runCmdOpts(opts)[source]

Perform the command actions. Must be implemented by Cmd implementers.

Parameters:

opts (dict) – Options dictionary.

synapse.cmds.hive module

class synapse.cmds.hive.HiveCmd(cli, **opts)[source]

Bases: Cmd

Manipulates values in a cell’s Hive.

A Hive is a hierarchy persistent storage mechanism typically used for configuration data.

static parsepath(path)[source]

Turn a slash-delimited path into a list that hive takes

async runCmdOpts(opts)[source]

Perform the command actions. Must be implemented by Cmd implementers.

Parameters:

opts (dict) – Options dictionary.