pbs_rescquery(3B)

πŸ“¦ version 6.1.3, in epel 9, nixos 26.05, nixpkgs unstable

πŸ’– pbs_rescquery(3B) β€” your fave resource availability bestie πŸ’–

okay so real talk: this is the pbs_rescquery(3B) page from the PBS manual. It's giving "I need to know what nodes are free" energy, and honestly? Iconic. Let's get into it 🫢


✨ NAME ✨

pbs_rescquery, avail, totpool, usepool β€” all about asking the batch server "hey bestie, what resources do we actually have?" πŸ’…


🌸 SYNOPSIS 🌸

#include <pbs_error.h>
#include <pbs_ifl.h>

int pbs_rescquery(int connect, char **resourcelist, int arraysize,
int *available, int *allocated, int *reserved, int *down )

char *avail(int connect, char *resc)

int totpool(int connect, int update)

int usepool(int connect, int update)

πŸ¦‹ DESCRIPTION πŸ¦‹

πŸ’œ pbs_rescquery

So this one literally sends a request to the batch server asking about resource availability. Slay.

  • connect β€” the connection you got back from pbs_connect() πŸ’«
  • resourcelist β€” an array of one or more strings saying which resources you're asking about
  • arraysize β€” the number of strings chillin' in resourcelist
  • available, allocated, reserved, down β€” integer arrays, all size arraysize. The amount of each resource from the matching resourcelist string gets dropped into these bad boys: what's available, what's already allocated, what's reserved, and what's down/off-line πŸ‘‘

rn the only resource you can specify is "nodes", and you can write it like:

nodes
nodes=
nodes=specification

where specification is exactly what a user would put in the -l option argument list for nodes β€” check qsub(1B) and the various pbs_resource_* man pages for the deets πŸ“š

When the node resourcelist is a simple type β€” like "nodes", "nodes=", or "nodes=type" β€” the numbers coming back are the actual count of nodes (of that specified type) that are available, allocated, reserved, or down. No cap.

For a more complex node resourcelist β€” like "nodes=2" or "nodes=type1:type2" β€” only the value in available has meaning, periodt:

  • If available is positive, it's the number of nodes required to satisfy the specification, and some set of nodes is available that will satisfy it (see avail() below πŸ‘€).
  • If available is zero, some number of nodes required to satisfy the specification are currently unavailable β€” the request might get satisfied later, so don't lose hope bestie 😭
  • If available is negative, no combination of known nodes can satisfy the specification. It's giving never-ever energy πŸ’€

πŸŽ€ avail

The avail() call is a conversion aid for schedulers written for early versions of PBS. It uses pbs_rescquery() and returns a character string answer. Very throwback, very demure ✨

  • connect β€” the connection from pbs_connect()
  • resc β€” a single node=specification spec, same as discussed above

What you get back:

  • If the nodes to satisfy the spec are currently available β†’ the string yes
  • If they're currently unavailable β†’ the string no
  • If the spec could never be satisfied β†’ the string never
  • If there's an error in the specification β†’ the string ?

🧚 totpool

totpool() returns the total number of nodes known to the PBS server. That's the sum of available + allocated + reserved + down. Math girlie behavior πŸ“

  • connect (called connection in the param list above) β€” the connection from pbs_connect()
  • update β€” if non-zero, totpool() issues a pbs_rescquery() call to get fresh info. If zero, it uses numbers from the prior pbs_rescquery(). Your choice, bestie πŸ’«

πŸ’œ usepool

usepool() returns the number of nodes currently in use β€” that's allocated + reserved + down. Main character energy for the "busy" nodes πŸ‘‘

  • connect (again, connection in the param list) β€” the connection from pbs_connect()
  • update β€” if non-zero, totpool() issues a pbs_rescquery() call to get fresh info. If zero, numbers from the prior pbs_rescquery() are used.
πŸ’€ careful: the manpage literally says totpool() in the usepool() description for the update param. Not me, not my typo, that's just what it says. Copying it verbatim because facts are facts.

🌈 SEE ALSO 🌈

qsub(1B), pbs_connect(3B), pbs_disconnect(3B), pbs_rescreserve(3B) and pbs_resources(7B) β€” go read these too, iykyk πŸ“–


πŸ”₯ DIAGNOSTICS πŸ”₯

When the batch request generated by pbs_rescquery() is completed successfully by a batch server, the routine returns 0 (zero). Otherwise, a non-zero error is returned. The error number is also set in pbs_errno. ✨

The functions usepool() and totpool() return -1 on error. Sad but true 🫢


πŸ’… cute sign-off πŸ’…

This page comes from the Local source, version 3B, and yeah β€” that's the whole vibe. Stay resourceful, bestie. πŸ’–πŸŒΈπŸ¦‹βœ¨

pbs_rescquery(3B) β€” Local, 3B β€” periodt πŸŽ€

πŸ“¦ where this page comes from