Python API#

Gecko is mainly a command-line tool. These modules are documented for contributors and for scripting. The API isn’t stable yet and may change between minor releases.

gecko.triage#

Core Gecko triage workflow.

Triage aspects of any observatory system or instrument to provide a quick overview of the system health and status at any point. Specifically designed for execution at a crash or issue during observation.

Original author: Elijah Anakalea-Buckley

exception gecko.triage.GeckoConfigError[source]#

Bases: RuntimeError

Raised when the Gecko configuration file is missing values or not initialized.

class gecko.triage.Triagetools(config: str, message: str = '', init=False)[source]#

Bases: object

Collect diagnostics and build a Gecko report bundle.

Parameters:
  • config – Path to an initialized Gecko .ini configuration file.

  • message – User-provided description written at the top of the report.

  • init – When true, interactively prompt for every setting and write config instead of loading it.

initialize(config)[source]#

Initialize and configure the application

load_config(config)[source]#

Load the configuration file

gather_system_info()[source]#

Gather system information such as CPU, memory, disk usage

take_screenshots()[source]#

Take screenshots of the system state on all possible monitors

capture_session(session)[source]#

Captures a specific session through x11

find_displays()[source]#

Find active X11 displays by checking /tmp/.X11-unix/X*

gather_logs()[source]#

Gathers Logs from all paths to dump into tar comp.

comb_logs()[source]#

Comb logs for errors and warnings

compress_report()[source]#

Compresses report file into a tar.gz format to be emailed

grab_science_image()[source]#

Grabs most recent science image(s) to include in triage

send_report()[source]#

Send the generated report to specified recipients.

gecko.config#

Locate and create Gecko configuration files.

Lookup order used by resolve_config_path():

  1. An explicit path (--config).

  2. The GECKO_CONFIG environment variable.

  3. The per-user file $XDG_CONFIG_HOME/gecko/gecko.ini (default ~/.config/gecko/gecko.ini).

  4. The system-wide file /etc/gecko/gecko.ini.

  5. A legacy triage_package/triage.ini from a pre-0.2 source checkout, if it was initialized.

gecko.config.user_config_path()[source]#

Return the per-user config path, honoring XDG_CONFIG_HOME.

gecko.config.legacy_config_paths()[source]#

Return candidate locations of a pre-0.2 triage_package/triage.ini.

gecko.config.is_initialized(path)[source]#

Return True if path is a readable config with System.initialized = true.

gecko.config.find_legacy_config()[source]#

Return an initialized legacy config path, or None.

gecko.config.resolve_config_path(explicit=None)[source]#

Return the config file Gecko should read.

If no existing file is found, the per-user path is returned so that error messages point the operator at the location gecko -init will create.

gecko.config.init_target_path(explicit=None)[source]#

Return the config file gecko -init should write.

gecko.config.ensure_config_file(target)[source]#

Create target if needed and return its path.

A new file is seeded from an initialized legacy config when one exists (so gecko -init migrates old settings), otherwise from the packaged template.

gecko.cli#

Command-line interface for Gecko.

gecko.cli.build_parser()[source]#

Build the gecko argument parser.

gecko.cli.run_initialize(config)[source]#

Run the interactive configuration prompts.

gecko.cli.run_report(config, user, message)[source]#

Run the full triage workflow and return an exit code.

gecko.cli.main(argv=None)[source]#

Entry point for the gecko command. Returns a process exit code.