mstar.engine.resources.admission#

Admission across the resources of one runner, see Resource.ask.

Classes

Admission(resources, ask_order)

The queues of the resources that ask, and the nodes each request was admitted on.

Refusal(rid, key, node_name, mark)

A waiting request that didn't fit, the resource that refused it, the node it asked that resource for, and the mark that resource returned.

class mstar.engine.resources.admission.Admission(resources, ask_order)[source]#

Bases: object

The queues of the resources that ask, and the nodes each request was admitted on.

A waiting request is admitted once it is first in every queue it is in and each resource it asked reserves for it, all or nothing. It may also pass the first request of a queue whose resource overrides Resource.reserve_past, while that request can’t start (_pass), and stand anywhere in the queue of such a resource once it asks nothing more of the request (Resource.ask), since that takes nothing from the requests ahead of it. A request that asks again (readmit) waits in no queue, and admit_waiting tries it, oldest first, whenever what it didn’t fit has grown. It holds up no newer request unless it is the oldest request that has asked a resource it waits for, when that resource’s queue admits no one it hasn’t already reserved for, so newer prompts can’t keep passing it.

Parameters:
admit(rid, node_name, graph_walk, published, keys)[source]#

None once rid is admitted on node_name, else why it waits or fails. keys are the resources of node_name that ask.

Parameters:
Return type:

FullAdmitOutcome | None

admit_waiting(published_of)[source]#

Admit each return that now fits, oldest first, then each waiting request that is now first in every queue it is in, held back by no return, and fits, then each that passes a first request that can’t start, or waits where a resource holds what it asked for, in arrival order, and return the (node, rid) pairs that may start. published_of(rid, node) gives what the request published for that node’s resources.

Nothing is tried until a resource whose first waiting request didn’t fit has grown, a mark that requests passing were refused against has grown, or a queue has a new first request, and a return is tried once it starts to return or what it didn’t fit has grown. A pass that changed none of these costs one Resource.grew_since for each such resource, mark and return.

Parameters:

published_of (Callable[[str, str], Mapping[str, PublishedInfo] | None])

Return type:

list[tuple[str, str]]

admitted(rid, node_name)[source]#
Parameters:
Return type:

bool

newer_than(rid)[source]#

The requests numbered after rid, newest first, or None when the conductor gave rid no number.

Parameters:

rid (str)

Return type:

list[str] | None

older_than(rid)[source]#

The requests numbered before rid, newest first, or none when the conductor gave rid no number.

Parameters:

rid (str)

Return type:

list[str]

readmit(rid, node_name, keys)[source]#

Ask node_name’s resources again for rid, since a drop or a move to the host may have given back what they admitted it with. A resource that did asks now, and rid waits as a return unless it already waits as a new request. keys are the resources of node_name that ask.

Parameters:
Return type:

None

refusals()[source]#

The waiting requests that have been tried and didn’t fit, oldest first.

Return type:

list[Refusal]

remove_request(rid)[source]#
Parameters:

rid (str)

Return type:

None

set_arrival(rid, arrival)[source]#

Order rid by the conductor’s arrival number. A worker serving two of the request’s partitions ingests it once for each, with the same number.

Parameters:
Return type:

None

class mstar.engine.resources.admission.Refusal(rid, key, node_name, mark)[source]#

Bases: NamedTuple

A waiting request that didn’t fit, the resource that refused it, the node it asked that resource for, and the mark that resource returned.

Parameters:
key: str#

Alias for field number 1

mark: object#

Alias for field number 3

node_name: str#

Alias for field number 2

rid: str#

Alias for field number 0