saealib.ThreadPoolEvaluator#

saealib.ThreadPoolEvaluator#

alias of AsyncEvaluator

Methods

__init__

acknowledge

Acknowledge one asynchronous update.

can_reattach

Return whether pending work can be restored after checkpoint load.

cancel

Cancel work that has not started.

close

Release worker resources.

collect

Collect one completed update, optionally without waiting.

contract

Return the evaluator family contract.

detach

Detach a running future and discard its eventual result.

evaluate_batch

Evaluate one batch on the wrapped evaluator.

evaluate_request

Evaluate a request, including its public metadata boundary.

has_partial_lifecycle_override

Return whether lifecycle adapter methods are only partly overridden.

reattach

Restore a pending request or raise when unsupported.

submit

Submit work without blocking the caller.

supports_batch_rollback

Return whether submitted futures can be detached.

Method Details

ThreadPoolEvaluator.__init__(evaluator=None, *, max_workers=1)#
Parameters:
  • evaluator (Evaluator | None)

  • max_workers (int)

Return type:

None

ThreadPoolEvaluator.acknowledge(handle, sequence)#

Acknowledge one asynchronous update.

Parameters:
Return type:

None

ThreadPoolEvaluator.can_reattach(pending)#

Return whether pending work can be restored after checkpoint load.

Parameters:

pending (PendingEvaluation)

Return type:

bool

ThreadPoolEvaluator.cancel(handle)#

Cancel work that has not started.

Parameters:

handle (EvaluationHandle)

Return type:

bool

ThreadPoolEvaluator.close()#

Release worker resources.

Return type:

None

ThreadPoolEvaluator.collect(handle, *, wait=True)#

Collect one completed update, optionally without waiting.

Parameters:
Return type:

list[EvaluationUpdate]

ThreadPoolEvaluator.contract()#

Return the evaluator family contract.

Return type:

ComponentContract

ThreadPoolEvaluator.detach(handle)#

Detach a running future and discard its eventual result.

Parameters:

handle (EvaluationHandle)

Return type:

bool

ThreadPoolEvaluator.evaluate_batch(x, problem)#

Evaluate one batch on the wrapped evaluator.

Parameters:
  • x (GenomeBatch | np.ndarray)

  • problem (Problem)

Return type:

EvaluationResult

ThreadPoolEvaluator.evaluate_request(request, problem)#

Evaluate a request, including its public metadata boundary.

Parameters:
Return type:

EvaluationResult

classmethod ThreadPoolEvaluator.has_partial_lifecycle_override()#

Return whether lifecycle adapter methods are only partly overridden.

Return type:

bool

ThreadPoolEvaluator.reattach(pending, problem)#

Restore a pending request or raise when unsupported.

Parameters:
Return type:

EvaluationHandle

ThreadPoolEvaluator.submit(request, problem)#

Submit work without blocking the caller.

Parameters:
Return type:

EvaluationHandle

ThreadPoolEvaluator.supports_batch_rollback()#

Return whether submitted futures can be detached.

Return type:

bool