pyats.log.commands package¶
Subpackages¶
Submodules¶
-
class
pyats.log.commands.archive.Archive(archive, unzip_dir=None)¶ Bases:
pyats.log.commands.archive.FileHandler-
extract_archive()¶
-
listdir(folder=None, _depth=0, _parent_id=0)¶
-
parse_archive(**kwargs)¶
-
read_bytes(logfile, log_start=0, log_size=- 1, offset=0, limit=0)¶ return the logs for a secton/step, paginated according to offset/limit. log_start: start bytes of section in the log file. log_size: bytes size of section. offset: (Optional) start point for current trunk. bytes offset
inside the log section.
limit: (Optional) size of current trunk.
-
read_file(filename, read_lines=False)¶
-
read_lines(logfile, offset=None, limit=None, log_start=0, log_size=- 1)¶ return a list of file content, seperated by lines. return the whole file when passing no parameter. log_start: start btyes of section in the log file. log_size: bytes size of section. offset: start line # in the section. limit: # of lines to read
-
-
class
pyats.log.commands.archive.FileHandler(_dir)¶ Bases:
object-
listdir(folder=None, _depth=0, _parent_id=0)¶
-
read_bytes(logfile, log_start=0, log_size=- 1, offset=0, limit=0)¶ return the logs for a secton/step, paginated according to offset/limit. log_start: start bytes of section in the log file. log_size: bytes size of section. offset: (Optional) start point for current trunk. bytes offset
inside the log section.
limit: (Optional) size of current trunk.
-
read_file(filename, read_lines=False)¶
-
read_lines(logfile, offset=None, limit=None, log_start=0, log_size=- 1)¶ return a list of file content, seperated by lines. return the whole file when passing no parameter. log_start: start btyes of section in the log file. log_size: bytes size of section. offset: start line # in the section. limit: # of lines to read
-
-
class
pyats.log.commands.archive.RunInfoFileHandler(runinfo_dir)¶ Bases:
pyats.log.commands.archive.FileHandler-
get_tail_start(filename, start_bytes=0, line_offset=20)¶ reads file by line and gets line and bytes number of where to start tailing line_offset is the number of previous lines to show from tailing
-
tailing_file(filename, start_bytes=0)¶ tailing_file function tail file in separated process in non blocking fashion
-
-
pyats.log.commands.archive.file_flag(flag_name)¶ Creates temp file within cache to indicate active parsing
-
class
pyats.log.commands.logs.ListSubcommand(parent)¶ Bases:
pyats.cli.base.Subcommand-
description= '\nlist all archives stored in standard known archive locations.\n '¶
-
help= 'list all log archives'¶
-
name= 'list'¶
-
run(args)¶ runs this subcommand
-
-
class
pyats.log.commands.logs.LogsCommand(*args, **kwargs)¶ Bases:
pyats.cli.base.CommandWithSubcommands-
SUBCMDS_ENTRYPOINT= ''¶
-
SUBCOMMANDS= [<class 'pyats.log.commands.logs.ViewSubcommand'>, <class 'pyats.log.commands.logs.ListSubcommand'>]¶
-
help= 'command enabling log archive viewing in local browser'¶
-
name= 'logs'¶
-
-
class
pyats.log.commands.logs.ViewSubcommand(*args, **kwargs)¶ Bases:
pyats.cli.base.Subcommand-
description= '\nOpens pyATS generated archive zip files and host them through HTTP server.\n\nBehavior:\n - List all archives stored in standard known archive locations in reverse \n order on webpage.\n - Click to view detail results of an archive.\n - set environment variable $BROWSER to your browser executable to force using\n your provided browser\n - if liveview is enabled, opens the lastest running job.\n\nExamples:\n # opens the archive list page\n $ pyats logs view\n\n # opens the last generated archive file\n $ pyats logs view --latest\n\n # open a specific archive file\n $ pyats logs view /path/to/archive.zip\n '¶
-
help= 'open and view log archives in browser'¶
-
name= 'view'¶
-
run(args)¶ runs this subcommand
-
usage= '{prog} [archive] [options]'¶
-
-
class
pyats.log.commands.server.LogViewerServer(*args, **kwds)¶ Bases:
MutableMapping[Union[str,aiohttp.helpers.AppKey[Any]],Any]- keep_alive: if True, when liveview job finishes,
keep serving the logviewer
-
commands(request)¶
-
configure_routes(url_prefix='/private/v1/standalone')¶
-
download_archive(request)¶
-
download_file(request)¶
-
error_middleware(request, handler)¶
-
filebytes(request)¶
-
filelines(request)¶
-
files(request)¶
-
htmlviewer(request)¶
-
index(request)¶ serve index page
-
log_save(request)¶
-
logfile_cmd(request)¶
-
logfile_sec(request)¶
-
redirect(request)¶
-
results(request)¶
-
results_list(request)¶ list all results data with pagination URL: /results
-
sections(request)¶
-
serve(*args, **kwargs)¶ serve this single-app web server
-
setup_swagger_docs()¶
-
static(request)¶
-
pyats.log.commands.server.validate_uuid(func)¶