manager

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package manager provides concurrent job submission, polling, and result retrieval across multiple quantum backends.

A Manager holds registered backends and offers Manager.Submit for synchronous execution, Manager.SubmitAsync for single-backend async, Manager.SubmitBatch for multi-backend fan-out, and Manager.Watch for streaming status updates.

Concurrency is bounded by WithMaxConcurrent. Observability hooks from the context are invoked automatically around job lifecycle events.

Package manager provides concurrent job submission and polling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles concurrent job submission, polling, and result retrieval.

func New

func New(opts ...Option) *Manager

New creates a job manager.

func (*Manager) Register

func (m *Manager) Register(name string, b backend.Backend)

Register adds a backend to the manager.

func (*Manager) Submit

func (m *Manager) Submit(ctx context.Context, name string, req *backend.SubmitRequest) (*backend.Result, error)

Submit sends a job to a backend, polls until completion, and returns the result.

func (*Manager) SubmitAsync

func (m *Manager) SubmitAsync(ctx context.Context, name string, req *backend.SubmitRequest) <-chan ResultOrError

SubmitAsync sends a job and returns a channel that delivers the result.

func (*Manager) SubmitBatch

func (m *Manager) SubmitBatch(ctx context.Context, backends []string, req *backend.SubmitRequest) <-chan ResultOrError

SubmitBatch sends the same request to multiple backends concurrently. Results are delivered on the returned channel as they complete.

func (*Manager) SubmitSweep

func (m *Manager) SubmitSweep(ctx context.Context, name string, c *ir.Circuit, shots int, sw sweep.Sweep) <-chan SweepResultOrError

SubmitSweep resolves the sweep, binds each parameter point to the circuit, and submits each bound circuit to the named backend. Results are delivered on the returned channel as they complete.

func (*Manager) Watch

func (m *Manager) Watch(ctx context.Context, name string, jobID string) <-chan *backend.JobStatus

Watch returns a channel that delivers status updates for a job until it reaches a terminal state.

type Option

type Option func(*Manager)

Option configures a Manager.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger sets the structured logger for the manager.

func WithMaxConcurrent

func WithMaxConcurrent(n int) Option

WithMaxConcurrent sets the maximum number of concurrent job submissions.

func WithPollFrequency

func WithPollFrequency(d time.Duration) Option

WithPollFrequency sets how often the manager polls for job status.

type ResultOrError

type ResultOrError struct {
	Result  *backend.Result
	Backend string
	JobID   string
	Err     error
}

ResultOrError wraps a result or an error from an async submission.

type SweepResultOrError

type SweepResultOrError struct {
	Index    int
	Bindings map[string]float64
	Result   *backend.Result
	Backend  string
	JobID    string
	Err      error
}

SweepResultOrError wraps a result from a sweep point submission.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL