Skip to content

SingleTimeLoopTimeoutRuntimeErrorAnalysis

QuantConnect.Lean.Engine.Results.Analysis.Analyses.SingleTimeLoopTimeoutRuntimeErrorAnalysis

Bases: BaseResultsAnalysis

Detects algorithms terminated by an Isolator time limit, inspecting the error message for known text fragments. The runtime error is read from the result state, falling back to the "Runtime Error:" log line for results that carry no state. It covers a single time loop exceeding the per-loop limit ("Algorithm took longer than N minutes on a single time loop"), the whole run outliving the maximum allowed wall-clock time ("Execution Security Error: Operation timed out - N minutes max", "Failed to complete algorithm within N seconds"), and code still running once the shutdown grace period expires after a stop request ("Operation was canceled").

runs_in_run

runs_in_run: bool

A timeout runtime error terminates the backtest, so there is no in-progress run to analyze.

issue

issue: str

Gets the description of the timeout issue.

weight

weight: int

Gets the severity weight for this analysis. A timeout is a fatal error that terminated the run, so it ranks above every non-fatal finding.

is_state_based

is_state_based: bool

Whether this analysis reads the current backtest state (statistics, orders, charts) instead of scanning the append-only order event and log streams. When run in-run, it runs against the full current state on every run and its findings replace the previous ones instead of accumulating.

run

run(
    parameters: ResultsAnalysisRunParameters,
) -> Sequence[Analysis]
run(
    state: IDictionary[str, str],
    logs: Sequence[str],
    language: Language,
) -> Sequence[Analysis]

Signature descriptions:

  • Runs the runtime error analysis against the provided backtest parameters.

  • Runs the runtime error analysis against the algorithm state and logs.

Parameters:

Name Type Description Default
state Optional[IDictionary[str, str]]

The algorithm state of the result, holding the runtime error message if any.

None
logs Optional[Sequence[str]]

The full list of log lines produced by the backtest.

None
language Optional[Language]

The programming language the algorithm is written in.

None

Returns:

Type Description
Sequence[Analysis]

A single response with the matched error message and solutions, or without them when the error is not found.

single_response

single_response(
    sample: Any, solutions: Sequence[str] = None
) -> Sequence[Analysis]
single_response(
    sample: Any,
    count: Optional[int],
    solutions: Sequence[str] = None,
) -> Sequence[Analysis]

Wraps a single QuantConnect.Analysis in a one-element read-only list.

create_aggregated_response

create_aggregated_response(
    responses: List[Analysis],
) -> Sequence[Analysis]

Filters responses to those with solutions, prefixes the class name, and returns a flat list.

This Class is protected.

format_code

format_code(code: str, language: Language) -> str

Formats the specified code string according to the conventions of the given programming language.

This Class is protected.