flux.resource.ResourcePool module

Public wrapper for Flux scheduler resource pool implementations.

ResourcePool is a plain delegating wrapper around a ResourcePoolImplementation, following the same pattern as ResourceSet wraps a ResourceSetImplementation.

Calling ResourcePool(R) dispatches to the appropriate concrete implementation based on the version field in the R JSON:

  • Version 1 → Rv1Pool (pure-Python)

class flux.resource.ResourcePool.ResourcePool(arg=None, version=1, log=None, **kwargs)

Bases: object

Public wrapper for a resource pool implementation.

Accepts the same argument forms as ResourceSet:

  • An R JSON string or parsed dict → dispatches to the correct ResourcePoolImplementation subclass by version.

  • A ResourcePoolImplementation instance → wraps it directly.

exception InfeasibleRequest

Bases: OSError

Request can never be satisfied by this pool.

exception InsufficientResources

Bases: OSError

Not enough resources available right now — retry after a free event.

alloc(jobid: int, request) ResourcePool

Allocate resources for jobid and return the allocated pool.

check_feasibility(request) None

Check whether request is structurally satisfiable.

copy() ResourcePool

Return a full independent copy preserving allocation state.

copy_allocated()

Return a ResourceSet containing only the allocated resources.

copy_down()

Return a ResourceSet containing only the down resources.

dumps() str

Return a compact human-readable summary of the resource set.

property expiration: float

Resource expiration timestamp (seconds since epoch, 0 = none).

free(jobid: int, R=None, final: bool = False) None

Return a job's allocated resources to the pool.

property generation: int

Monotonically increasing mutation counter.

job_end_times()

Return a list of (jobid, end_time) pairs for all tracked jobs.

mark_down(ids: str) None

Mark resources identified by idset string (or "all") as down.

mark_up(ids: str) None

Mark resources identified by idset string (or "all") as up.

parse_resource_request(jobspec: dict)

Parse a jobspec dict and return a pool-specific resource request.

register_alloc(jobid: int, R: ResourcePool) None

Register an existing allocation during scheduler reconnect.

remove_ranks(ranks) None

Remove ranks from the pool (called on shrink events).

set_expiration(expiration: float) None

Set the resource set expiration (seconds since epoch, 0 = none).

set_starttime(starttime: float) None

Set the resource set starttime (seconds since epoch).

to_dict() dict

Return the resource set as a parsed R JSON dict.

to_resource_set()

Return a topology+availability snapshot as a ResourceSet.

update_expiration(jobid: int, expiration: float) None

Update the tracked end time for a running job.