seq  3.0.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
cli.seqsh.SeqShell Class Reference

Asynchronous wrapper around the subprocess seq kernel. More...

Inheritance diagram for cli.seqsh.SeqShell:
cli.seq_cmdasync.AsyncCmd

Public Member Functions

def __init__ (self, loop, redis_address, log_level, evt, use_stdout=True, use_redis=False)
 
def proc_reader (self)
 
def write_cmd (self, text)
 Write command to PIPE stdin. More...
 
def start_seq_core (self)
 
def emptyline (self)
 empty line handle More...
 
def do_clear (self, arg)
 
def do_quit (self, line)
 
def do_init (self, line="")
 
def do_err (self, line)
 
def do_load (self, line)
 
def do_modules (self, line)
 
def tpl_done_cb (self, task)
 a simple callback for pending command (unused) More...
 
def do_run (self, arg)
 Executes all loaded modules. More...
 
def do_nodes (self, arg)
 nodes command More...
 
def do_save (self, arg)
 save command More...
 
def do_session (self, arg)
 session command More...
 
def do_tree (self, arg)
 
def do_skip (self, arg)
 skip command More...
 
def do_unskip (self, arg)
 unskip command More...
 
def do_pause (self, arg)
 pause command More...
 
def do_flip (self, arg)
 flip command More...
 
def do_resume (self, arg)
 resume command More...
 
def do_break (self, arg)
 break command More...
 
def do_abort (self, arg)
 
def do_ob (self, arg)
 
def do_retry (self, arg)
 
def do_continue (self, arg)
 
def do_lsob (self, arg)
 
def do_lsvar (self, arg)
 
def do_setvar (self, arg)
 
def do_checked (self, arg)
 
def do_bp (self, arg)
 bypass to subprocess command More...
 
- Public Member Functions inherited from cli.seq_cmdasync.AsyncCmd
def __init__ (self, loop, completekey='tab', stdin=None, stdout=None)
 
def cb (self, f, arg, future)
 
def exc_handler (self, exc)
 
def onecmd (self, line)
 Interpret the argument as though it had been typed in response to the prompt. More...
 

Public Attributes

 proc
 
 reader_task
 
 quit_event
 
 redis
 
 use_redis
 
 use_stdout
 
 redis_port
 
 session
 
 s_json
 
- Public Attributes inherited from cli.seq_cmdasync.AsyncCmd
 use_rawinput
 
 loop
 
 repl_future
 
 lastcmd
 

Static Public Attributes

bool use_rawinput = False
 
 current_task = None
 
 modules_json = None
 
 log_level = logging.INFO
 
 ob = None
 
dictionary s_json = {}
 
dictionary tree = {}
 
string prompt = "(seq)>> "
 
list keywords
 

Detailed Description

Asynchronous wrapper around the subprocess seq kernel.

This class starts a subprocess seq kernel and writes commands to it through its stdin channel, and monitor its responses in the stdout channel.

Using the responses in stdout, it publishes to redis feedback on the sequencer commands and the progress of the sequence execution.

Constructor & Destructor Documentation

◆ __init__()

def cli.seqsh.SeqShell.__init__ (   self,
  loop,
  redis_address,
  log_level,
  evt,
  use_stdout = True,
  use_redis = False 
)

Member Function Documentation

◆ do_abort()

def cli.seqsh.SeqShell.do_abort (   self,
  arg 
)

◆ do_bp()

def cli.seqsh.SeqShell.do_bp (   self,
  arg 
)

bypass to subprocess command

◆ do_break()

def cli.seqsh.SeqShell.do_break (   self,
  arg 
)

break command

◆ do_checked()

def cli.seqsh.SeqShell.do_checked (   self,
  arg 
)

◆ do_clear()

def cli.seqsh.SeqShell.do_clear (   self,
  arg 
)
Kills suboprocess

◆ do_continue()

def cli.seqsh.SeqShell.do_continue (   self,
  arg 
)
continue command

◆ do_err()

def cli.seqsh.SeqShell.do_err (   self,
  line 
)
err command

◆ do_flip()

def cli.seqsh.SeqShell.do_flip (   self,
  arg 
)

flip command

◆ do_init()

def cli.seqsh.SeqShell.do_init (   self,
  line = "" 
)
init command

Connect to server(s) (Seq and redis)
Creates sequencer exec process

◆ do_load()

def cli.seqsh.SeqShell.do_load (   self,
  line 
)
load command

◆ do_lsob()

def cli.seqsh.SeqShell.do_lsob (   self,
  arg 
)
lsob command

◆ do_lsvar()

def cli.seqsh.SeqShell.do_lsvar (   self,
  arg 
)
lsvar command

◆ do_modules()

def cli.seqsh.SeqShell.do_modules (   self,
  line 
)
modules command

◆ do_nodes()

def cli.seqsh.SeqShell.do_nodes (   self,
  arg 
)

nodes command

◆ do_ob()

def cli.seqsh.SeqShell.do_ob (   self,
  arg 
)
Loads an OB file (json)

◆ do_pause()

def cli.seqsh.SeqShell.do_pause (   self,
  arg 
)

pause command

◆ do_quit()

def cli.seqsh.SeqShell.do_quit (   self,
  line 
)
quit command

◆ do_resume()

def cli.seqsh.SeqShell.do_resume (   self,
  arg 
)

resume command

◆ do_retry()

def cli.seqsh.SeqShell.do_retry (   self,
  arg 
)
retry command

◆ do_run()

def cli.seqsh.SeqShell.do_run (   self,
  arg 
)

Executes all loaded modules.

◆ do_save()

def cli.seqsh.SeqShell.do_save (   self,
  arg 
)

save command

◆ do_session()

def cli.seqsh.SeqShell.do_session (   self,
  arg 
)

session command

◆ do_setvar()

def cli.seqsh.SeqShell.do_setvar (   self,
  arg 
)
     setvar 0 {"0": [{"name": "par_a", "type": "n/a", "value": "sds"}, {"name": "par_b", "type": "integer", "value": "22"}, {"name": "par_c", "type": "number", "value": "33"}],

               "1": [{"name": "par_x", "type": "n/a", "value": "string"}, {"name": "par_y", "type": "integer", "value": 0}, {"name": "par_z", "type": "number", "value": 0}]}


     return  b'{"0": {"0": {"par_a": {"name": "par_a", "value": "pippo"}, "par_b": {"name": "par_b", "type": "integer", "value": 22}, "par_c": {"name": "par_c", "type": "number", "value": 44}}, "1": {"par_x": {"name": "par_x", "value": "sting"}, "par_y": {"name": "par_y", "type": "integer", "value": 66}, "par_z": {"name": "par_z", "type": "number", "value": 77}}}}'


{"0": {"par_a": {"name": "par_a", "value": "pippo"}, "par_b": {"name": "par_b", "type": "integer", "value": 22}, "par_c": {"name": "par_c", "type": "number", "value": 44}}, "1": {"par_x": {"name": "par_x", "value": "sting"}, "par_y": {"name": "par_y", "type": "integer", "value": 66}, "par_z": {"name": "par_z", "type": "number", "value": 77}}}

◆ do_skip()

def cli.seqsh.SeqShell.do_skip (   self,
  arg 
)

skip command

◆ do_tree()

def cli.seqsh.SeqShell.do_tree (   self,
  arg 
)
tree command

◆ do_unskip()

def cli.seqsh.SeqShell.do_unskip (   self,
  arg 
)

unskip command

◆ emptyline()

def cli.seqsh.SeqShell.emptyline (   self)

empty line handle

◆ proc_reader()

def cli.seqsh.SeqShell.proc_reader (   self)
Loop method. It monitors the lines from the `seq kernel` subprocess
stdout, and finds json formats.

Once a '{' character is found, it is assumed to be the start of a json
string. It is loaded as json.

Responses from the `seq kernel` include json formatted string which are
transformed into dictionaries.

From those, a set of keywords (seq.cli.keywords) are use to find
information of interest to be published to redis.

- State change (SEQ_STATE_CHANGE)
- Tree update (SEQ_TREE)
- OB update (SEQ_OB)
- Vars update (SEQ_TPL_VARS)
- Error (SEQ_ERROR)

◆ start_seq_core()

def cli.seqsh.SeqShell.start_seq_core (   self)
Starts sequencer interpreter process

◆ tpl_done_cb()

def cli.seqsh.SeqShell.tpl_done_cb (   self,
  task 
)

a simple callback for pending command (unused)

◆ write_cmd()

def cli.seqsh.SeqShell.write_cmd (   self,
  text 
)

Write command to PIPE stdin.

Member Data Documentation

◆ current_task

cli.seqsh.SeqShell.current_task = None
static

◆ keywords

list cli.seqsh.SeqShell.keywords
static
Initial value:
= [
KW.SEQ_MODULES,
KW.SEQ_TREE,
KW.SEQ_OB,
KW.SEQ_ERROR,
KW.SEQ_STATE_CHANGE,
KW.SEQ_TPL_VARS,
]

◆ log_level

cli.seqsh.SeqShell.log_level = logging.INFO
static

◆ modules_json

cli.seqsh.SeqShell.modules_json = None
static

◆ ob

cli.seqsh.SeqShell.ob = None
static

◆ proc

cli.seqsh.SeqShell.proc

◆ prompt

string cli.seqsh.SeqShell.prompt = "(seq)>> "
static

◆ quit_event

cli.seqsh.SeqShell.quit_event

◆ reader_task

cli.seqsh.SeqShell.reader_task

◆ redis

cli.seqsh.SeqShell.redis

◆ redis_port

cli.seqsh.SeqShell.redis_port

◆ s_json [1/2]

dictionary cli.seqsh.SeqShell.s_json = {}
static

◆ s_json [2/2]

cli.seqsh.SeqShell.s_json

◆ session

cli.seqsh.SeqShell.session

◆ tree

dictionary cli.seqsh.SeqShell.tree = {}
static

◆ use_rawinput

bool cli.seqsh.SeqShell.use_rawinput = False
static

◆ use_redis

cli.seqsh.SeqShell.use_redis

◆ use_stdout

cli.seqsh.SeqShell.use_stdout

The documentation for this class was generated from the following file: