Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
grepros.outputs.RolloverSinkMixin Class Reference
Inheritance diagram for grepros.outputs.RolloverSinkMixin:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, args=None, **kwargs)
 
def close_output (self)
 
def ensure_rollover (self, topic, msg, stamp)
 
def format_output_meta (self)
 
def get_write_options (cls, label)
 
def make_filename (self)
 
def size (self)
 
def validate (self)
 

Public Attributes

 filename
 Current output file path. More...
 

Static Public Attributes

 DEFAULT_ARGS = dict(VERBOSE=False, WRITE=None, WRITE_OPTIONS={})
 Constructor argument defaults. More...
 
string FILE_META_TEMPLATE = "{name} ({size})"
 
string MULTI_META_TEMPLATE = "\n- {name} ({size}, {mcount}, {tcount})"
 
list OPTIONS_TEMPLATES
 Command-line help templates for rollover options, as [(name, text with s label placeholder)]. More...
 
string START_META_TEMPLATE = "{mcount} in {tcount} to "
 

Private Attributes

 _rollover_files
 
 _rollover_limits
 
 _rollover_template
 

Detailed Description

Provides output file rollover by size, duration, or message count.

Definition at line 323 of file outputs.py.

Constructor & Destructor Documentation

◆ __init__()

def grepros.outputs.RolloverSinkMixin.__init__ (   self,
  args = None,
**  kwargs 
)
@param   args                 arguments as namespace or dictionary, case-insensitive
@param   args.write           base name of output file to write if not using rollover-template
@param   args.write_options   {"rollover-size": bytes limit for individual output files,
                       "rollover-count": message limit for individual output files,
                       "rollover-duration": time span limit for individual output files,
                                            as ROS duration or convertible seconds,
                       "rollover-template": output filename template, supporting
                                            strftime format codes like "%H-%M-%S"
                                            and "%(index)s" as output file index,
                       "overwrite": whether to overwrite existing file
                                    (default false)}
@param   kwargs               any and all arguments as keyword overrides, case-insensitive

Reimplemented in grepros.outputs.BagSink, grepros.plugins.mcap.McapSink, grepros.plugins.auto.sqlite.SqliteSink, and grepros.plugins.auto.html.HtmlSink.

Definition at line 351 of file outputs.py.

Member Function Documentation

◆ close_output()

def grepros.outputs.RolloverSinkMixin.close_output (   self)
Closes output file, if any.

Reimplemented in grepros.outputs.BagSink, grepros.plugins.mcap.McapSink, and grepros.plugins.auto.html.HtmlSink.

Definition at line 441 of file outputs.py.

◆ ensure_rollover()

def grepros.outputs.RolloverSinkMixin.ensure_rollover (   self,
  topic,
  msg,
  stamp 
)
Closes current output file and prepares new filename if rollover limit reached.

Definition at line 411 of file outputs.py.

◆ format_output_meta()

def grepros.outputs.RolloverSinkMixin.format_output_meta (   self)
Returns output file metainfo string, with names and sizes and message/topic counts.

Definition at line 458 of file outputs.py.

◆ get_write_options()

def grepros.outputs.RolloverSinkMixin.get_write_options (   cls,
  label 
)
Returns command-line help texts for rollover options, as [(name, help)].

Definition at line 500 of file outputs.py.

◆ make_filename()

def grepros.outputs.RolloverSinkMixin.make_filename (   self)
Returns new filename for output, accounting for rollover template and overwrite.

Definition at line 446 of file outputs.py.

◆ size()

def grepros.outputs.RolloverSinkMixin.size (   self)
Returns current file size in bytes, or None if size lookup failed.

Reimplemented in grepros.outputs.BagSink, and grepros.plugins.auto.sqlite.SqliteSink.

Definition at line 491 of file outputs.py.

◆ validate()

def grepros.outputs.RolloverSinkMixin.validate (   self)
Returns whether write options are valid, emits error if not, else populates options.

Reimplemented in grepros.outputs.BagSink, grepros.plugins.mcap.McapSink, grepros.plugins.auto.html.HtmlSink, and grepros.plugins.auto.sqlite.SqliteSink.

Definition at line 374 of file outputs.py.

Member Data Documentation

◆ _rollover_files

grepros.outputs.RolloverSinkMixin._rollover_files
private

Definition at line 368 of file outputs.py.

◆ _rollover_limits

grepros.outputs.RolloverSinkMixin._rollover_limits
private

Definition at line 366 of file outputs.py.

◆ _rollover_template

grepros.outputs.RolloverSinkMixin._rollover_template
private

Definition at line 367 of file outputs.py.

◆ DEFAULT_ARGS

grepros.outputs.RolloverSinkMixin.DEFAULT_ARGS = dict(VERBOSE=False, WRITE=None, WRITE_OPTIONS={})
static

Constructor argument defaults.

Definition at line 327 of file outputs.py.

◆ FILE_META_TEMPLATE

string grepros.outputs.RolloverSinkMixin.FILE_META_TEMPLATE = "{name} ({size})"
static

Definition at line 346 of file outputs.py.

◆ filename

grepros.outputs.RolloverSinkMixin.filename

Current output file path.

Definition at line 371 of file outputs.py.

◆ MULTI_META_TEMPLATE

string grepros.outputs.RolloverSinkMixin.MULTI_META_TEMPLATE = "\n- {name} ({size}, {mcount}, {tcount})"
static

Definition at line 348 of file outputs.py.

◆ OPTIONS_TEMPLATES

list grepros.outputs.RolloverSinkMixin.OPTIONS_TEMPLATES
static
Initial value:
= [
("rollover-size=NUM", "size limit for individual files\nin {label} output\n"
"as bytes (supports abbreviations like 1K or 2M or 3G)"),
("rollover-count=NUM", "message limit for individual files\nin {label} output\n"
"(supports abbreviations like 1K or 2M or 3G)"),
("rollover-duration=INTERVAL", "message time span limit for individual files\n"
"in {label} output\n"
"as seconds (supports abbreviations like 60m or 2h or 1d)"),
("rollover-template=STR", "output filename template for individual files\n"
"in {label} output,\n"
'supporting strftime format codes like "%%H-%%M-%%S"\n'
'and "%%(index)s" as output file index'),
]

Command-line help templates for rollover options, as [(name, text with s label placeholder)].

Definition at line 330 of file outputs.py.

◆ START_META_TEMPLATE

string grepros.outputs.RolloverSinkMixin.START_META_TEMPLATE = "{mcount} in {tcount} to "
static

Definition at line 344 of file outputs.py.


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


grepros
Author(s): Erki Suurjaak
autogenerated on Sat Jan 6 2024 03:11:30