Skip to content

Enable more pyroSAR logging #173

Description

@truth-quark

By default, it appears pyroSAR doesn't log errors when calling GAMMA commands. Some recent setup work uncovered this when a workflow failed, but didn't crash until a downstream component failed due to missing files. The lack of logs hid the error source in the workflow, which isn't ideal if debugging is required.

Logging should be enabled for pyroSAR operations, particularly for capturing errors.

The docs for pyroSAR are incomplete & don't provide an obvious example a preferred method for logging (in the usage context of sar-pipeline).

GAMMA Context

During install, pyroSAR creates the ~/.pyrosar/gammaparse directory before generating thousands of lines of Python code to interface with GAMMA.

Example generated function from ~/.pyrosar/gammaparse/diff.py:

def base_add(base_1,
             base_2,
             base_out,
             mode='-',
             logpath=None,  # NB:  no logging by default
             outdir=None,
             shellscript=None):
    # skip docstring
    cmd = ['/g/data/dg9/GAMMA/GAMMA_SOFTWARE-20230712/DIFF/bin/base_add', base_1, base_2, base_out, mode]
    process(cmd, logpath=logpath, outdir=outdir, shellscript=shellscript)

The process() func is defined in pyroSAR/gamma/auxil.py:

def process(
        cmd: list[str],
        outdir: str | None = None,
        logfile: str | None = None,
        logpath: str | None = None,  # NB:  no logging by default
        inlist: list[str] | None = None,
        void: bool = True,
        shellscript: str | None = None
) -> tuple[str, str] | None:
    ...  # rest of body

By default, errors will be silenced.

Potential solutions

  1. Ensure logging params are specified for any operations called from sar-pipeline (problem: some ops are missing logging)
  2. Uglier: modify the ~/.pyrosar/gammaparse/<file>.py code with logfile params
  3. Monkeypatch (not for production, only for debugging)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions