flux.queue module

class flux.queue.QueueConf(conf)

Bases: object

The job-manager's authoritative queue configuration.

Wraps a job-manager.queue-list "conf" object ({"queues": [...], "policy"?: {...}, "default_queue"?: str}) and exposes per-queue effective configuration. The job-manager resolves everything, so a queue's requires and policy are effective values (RFC 33 virtual-queue inheritance and the global policy are already merged in).

Fetch from a live instance with queue_config_fetch(). Build from a raw broker config with from_config() (the --config-file / stdin / test path). The empty (anonymous-queue) case is a QueueConf with no entries.

property default_queue

The configured default queue name, or "" if none.

defaults(name=None)

The queue's effective job defaults (policy.jobspec.defaults.system), an empty dict if none.

property entries

The raw name -> conf-entry dict.

A low-level escape hatch for bulk/iteration consumers whose access pattern does not fit the per-queue accessors (requires/parent) -- e.g. flux-resource's dict-oriented rendering. Prefer the accessors for per-queue lookups.

classmethod from_config(config)

Return a QueueConf built from a raw broker config (the config-file test path). See queue_conf_from_config().

parent(name)

The queue's resolved parent name (RFC 33 virtual queue), or "".

The job-manager's authoritative view of the resolved parent.

policy(name=None)

The queue's effective policy dict (empty if none).

The job-manager has already merged the global policy, RFC 33 virtual-queue inheritance, and the queue's own policy, so this is a direct lookup. name None or an unconfigured queue (the anonymous-queue case) -> the global policy.

requires(name)

The queue's effective required-properties list, or None.

Already vqueue-resolved by the job-manager (a virtual queue reports its parent's requires). name may be None or an unconfigured queue (the anonymous-queue case) -> None.

class flux.queue.QueueConfRPC(flux_handle)

Bases: RPC

A pending queue configuration fetch from a Flux instance.

Sends the job-manager.queue-list RPC on construction (so it can overlap with other work) and returns a QueueConf from get(). An older job-manager omits the "conf" object, so get() then falls back to deriving the config from the broker config via a synchronous config.get RPC.

get()

Return the QueueConf. Blocks until the request completes.

class flux.queue.QueueDefaults(duration: float)

Bases: object

Class representing common queue defaults.

duration

Default job duration in seconds.

Type

float

timelimit

Synonym for duration.

Type

float

duration: float
property timelimit

timelimit is a alternate field name for duration for use in flux queue list

class flux.queue.QueueInfo(name, queue_conf, resources, enabled, started, default, blocked=None)

Bases: object

Information for a single queue.

Attrs:

name (str): The queue name (empty string for anonymous queue) is_default (bool): True if this is the default queue enabled (bool): True if this queue is enabled started (bool): True if this queue is started (effective state,

i.e. own AND parent for an RFC 33 virtual queue)

blocked (str): Reason keyword (RFC 33) if this queue's own started

bit is set but it is effectively stopped by an external condition: "scheduler" (scheduler offline) or "parent" (a virtual queue's parent is stopped). None otherwise. An unrecognized keyword is treated as a generic blocked condition.

parent (str): Name of the parent queue if this is an RFC 33

virtual queue, otherwise an empty string

resources (QueueResources): resources currently in this queue defaults (QueueDefaults): defaults that apply to this queue limits (QueueLimits): policy limits that apply to this queue

class flux.queue.QueueLimits(min: QueueResourceCounts, max: QueueResourceCounts, duration: float)

Bases: object

Class representing queue limits.

min

Configured resource minimums.

Type

QueueResourceCounts

max

Configured resource maximums. (If no maximum, individual resource count will be inf)

Type

QueueResourceCounts

duration

duration limit in seconds.

Type

float

timelimit

synonym for duration.

Type

float

duration: float
max: QueueResourceCounts
min: QueueResourceCounts
property timelimit

timelimit is a alternate field name for duration for use in flux queue list

class flux.queue.QueueList(handle, queues=None)

Bases: object

Gather information about currently configured Flux queues.

Parameters
  • handle (flux.Flux) -- handle to Flux

  • queues (list) -- Optional list of queue names to target. If None or an empty list, then information for all configured queues will be targeted.

class flux.queue.QueueResourceCounts(nnodes: float, ncores: float, ngpus: float)

Bases: object

Class containing counts of basic resources, used by QueueLimits and QueueDefaults.

nnodes

Count of nodes

Type

float

ncores

Count of cores

Type

float

ngpus

Count of gpus

Type

float

ncores: float
ngpus: float
nnodes: float
class flux.queue.QueueResources(resources, requires)

Bases: object

Container for resources assigned to an individual queue.

Attrs:

all (flux.resource.ResourceSet): all configured resources down (flux.resource.ResourceSet): down resources up (flux.resource.ResourceSet): resources that are not down allocated (flux.resource.ResourceSet): resources allocated to

jobs

free (flux.resource.ResourceSet): resources not down or

allocated to jobs

flux.queue.queue_conf_from_config(config)

Build the job-manager.queue-list "conf" object from a raw broker config.

This helper creates a job-manager.queue-list response conf object directly from broker config. For use in testing and as a fallback when the job-manager is from an older version of Flux that does not provide the queue config directly.

Returns {"queues": [{"name": str, "requires"?: list, "parent"?: str, "policy"?: dict}, ...], "policy"?: dict, "default_queue"?: str}. A virtual queue (RFC 33) has no "requires" of its own, so its effective "requires" is resolved from its parent. Each queue's "policy" is its fully effective policy (the global [policy], the parent's policy for a virtual queue, and its own, merged per key). The top-level "policy" is the global [policy] (the effective policy for the anonymous queue or a job with no queue) and "default_queue" is the default queue name.

Parameters

config (dict) -- a broker config, e.g. from the config.get RPC.

Raises

ValueError -- a virtual queue names a parent that is not configured.

flux.queue.queue_config_fetch(handle)

Send a request for the instance's queue configuration.

Parameters

handle (flux.Flux) -- a Flux handle

Returns

a pending fetch; get() returns a QueueConf. The request is sent immediately, so the fetch can overlap with other RPCs before get() is called.

Return type

QueueConfRPC