spectre.tools.Status.ExecutableStatus.ExecutableStatus

class spectre.tools.Status.ExecutableStatus.ExecutableStatus

Base class for providing status information for SpECTRE executables.

Subclasses read output from executables and provide status information. For example, a subclass for a binary black hole evolution executable can provide the current separation and number of orbits.

Properties:
executable_name_patterns: List of regex patterns that match the executable

names the subclass applies to. For example, r”^Evolve” matches all executables that start with “Evolve”.

fields: Dictionary of all field names the subclass provides and their

units. For example: {“Time”: “M”, “Orbits”: None} if the subclass provides time in units of mass and orbits with no unit.

__init__()

Methods

__init__()

format(field, value)

Transform status values to human-readable strings.

render_dashboard(job, input_file, metadata)

Render a dashboard for the job (experimental).

status(input_file, work_dir)

Provide status information of an executable run.

Attributes

executable_name_patterns

fields

executable_name_patterns: List[str] = []
fields: Dict[str, str | None] = {}
format(field: str, value: Any) str

Transform status values to human-readable strings.

Parameters:
  • field – The name of the field, as listed in ‘fields’ (e.g. “Time”).

  • value – The status value of the field, as returned by ‘status()’.

Returns: Human-readable representation of the value.

render_dashboard(job: dict, input_file: dict, metadata: dict)

Render a dashboard for the job (experimental).

Parameters:
  • job – A dictionary of job information, including the input file and working directory. See the ‘spectre.tools.Status.fetch_status’ function for details.

  • input_file – The input file read in as a dictionary.

  • metadata – The input file metadata read in as a dictionary.

This method can be overridden by subclasses to provide a custom dashboard for the job. The default implementation does nothing.

status(input_file: dict | None, work_dir: str | None) dict

Provide status information of an executable run.

Parameters:
  • input_file – The input file read in as a dictionary.

  • work_dir – The working directory of the executable run. Paths in the input file are relative to this directory.

Returns: Dictionary of ‘fields’ and their values. For example:

{“Time”: 10.5, “Orbits”: 3}. Not all fields must be provided if they can’t be determined.

Note: Avoid raising exceptions in this function. It is better to provide

only a subset of fields than to raise an exception. For example, if there’s an error reading the number of orbits, intercept and log the exception and just skip providing the number of orbits.