solprop.backends.host.session#

The NumPy reference’s run session (SEP 47 sections 5 and 6.6).

HostSession is the RunSession that serves every numpy_ref run, in both precisions: the launch-before-monitor order, the plane schedule, the snapshot latch, bounded yields, chunked attempts, exports and the terminal outcome with its checkpoint eligibility, over the reference’s own driver (solprop.backends.host.driver.HostDriver). It imports nothing of the inherited driver the native bridge still runs on.

A recorded exception. The reference otherwise shares only stateless numerical modules with the native bridge, but for phase 2 its lifecycle is the transitional session’s (solprop.backends.driver_session.DriverSession), reused by subclassing: it drives any driver through the backend protocol and the halt and yield hooks a host driver keeps (request_halt, clear_halt, set_halt_check, poll_halt and the latch _halted). The exception is removed when a later step of SEP 47 restructures this session into the reference’s own.

Classes

HostSession(driver, problem, request, start, *)

The reference's RunSession.

class solprop.backends.host.session.HostSession(driver, problem, request, start, *, listener=None, started=None, stop=None, owns=True)[source]#

Bases: DriverSession

The reference’s RunSession.

Parameters:
driversolprop.backends.protocol.Backend

The reference backend (a HostDriver), constructed for problem. The session closes it with itself when owns is set.

problemsolprop.translate.problem.PropagationProblem

The translated problem.

requestsolprop.translate.run_request.RunRequest

The run’s policies.

startsolprop.backends.session.Start

Where the run starts; the session takes its field.

listenercallable or None, optional

Called with each attempt as it is made, for a progress reporter. It observes only; it cannot change the run.

startedcallable or None, optional

Called with the start, the end and the plane count when propagation begins.

stopsolprop.log.StopFlag or None, optional

The run’s stop token, polled before every trial.

ownsbool, optional

Whether closing the session closes the driver. A caller that reuses its driver for later runs (a runner, a scan) keeps it open.

Raises:
solprop.exceptions.BackendError

If driver is not a reference driver.