run_basic

class xuance.engine.run_basic.RunnerBase(config, envs=None, agent=None, manage_resources=None)[source]

Bases: ABC

Abstract base class for all engine in XuanCe.

RunnerBase defines the common interface and shared infrastructure for all concrete engine (e.g., DRLRunner, MARLRunner).

A runner is responsible for experiment orchestration, including:
  • Environment lifecycle management.

  • Training / testing / benchmarking workflows.

  • Resource ownership and cleanup semantics.

  • Rank-aware logging in distributed settings.

Notes

  • Algorithm-specific logic must remain in the Agent.

  • Subclasses must implement the abstract methods declared here.

rprint(info: str)[source]

Rank-aware print utility.

Only prints messages on rank 0, which is useful for distributed training to avoid duplicated logs.

Parameters:

info – Message to print.

run(mode: str | None = None, **kwargs)[source]

Run the experiment.

Parameters:

mode (str) – Execution mode. Must be one of {‘train’, ‘test’, ‘benchmark’}.