pbs_python(1B)
β¨ NAME β¨ β pbs_python(1B), your hook-debugging bestie π
pbs_python β Python interpreter for debugging a hook script from the command line. No cap, this is the manual page for pbs_python(1B).
π¦ SYNOPSIS π¦
pbs_python --hook [-e <log event mask>] [-i <event input file>]
[-L <log dir>] [-l <log file>] [-o <hook execution record>]
[-r <resourcedef file>] [-s <site data file>] [<Python
script>]
pbs_python <standard Python options>
pbs_python --version
πΈ DESCRIPTION πΈ
The PBS Python interpreter, pbs_python, is a wrapper for Python. It's giving "Python but with PBS hook-debugging superpowers" β¨.
You can use the pbs_python wrapper that is shipped with PBS to debug hooks. Either:
- Use the
--hookoption topbs_pythonto runpbs_pythonas a wrapper to Python, employing thepbs_pythonoptions. With the--hookoption, you cannot use the standard Python options. The rest of this man page covers how to usepbs_pythonwith the--hookoption. - Do not use the
--hookoption, sopbs_pythonruns the Python interpreter, with the standard Python options, and without access to thepbs_pythonoptions.
π Debugging Hooks π
You can get each hook to write out debugging files, and then modify the files and use them as debugging input to pbs_python. Alternatively, you can write them yourself. Lowkey iconic.
Debugging files can contain information about the event, about the site, and about what the hook changed. You can use these as inputs to a hook when debugging.
π Options to pbs_python π
--hookβ This option is a switch. When you use this option, you can use the PBS Python module (viaimport pbs), and the other options described here are available. When you use this option, you cannot use the standard Python options. This option is useful for debugging.
When you do not use this option, you cannot use the other options listed here, but you can use the standard Python options.
-e <log event mask>β Sets the mask that determines which event types are logged bypbs_python. To see only debug messages, set the value to0xd80. To see all messages, set the value to0xffff. Thepbs_pythoninterpreter uses the same set of mask values that are used for the$logevent <mask>entry in thepbs_momconfiguration file. See thepbs_mom.8Bman page. Available only when--hookoption is used.-i <event input file>β Text file containing data to populatepbs.event()objects.
Each line specifies an attribute value or a resource value. Syntax of each input line is one of the following:
<object name>.<attribute name>=<attribute value>
<object name>.<resource list>[<resource name>]=<resource
value>
Where
<object name>is a PBS object name which can refer to its sub-objects. Examples:"pbs.event()","pbs.event().job","pbs.event().vnode_list["<vnode name>"]".
Example input file:
pbs.event().hook_name=proto
pbs.event().hook_type=site
pbs.event().type=queuejob
pbs.event().requestor=user1
pbs.event().requestor_host=host1
pbs.event().hook_alarm=40
pbs.event().job.id=72
pbs.event().job.Job_Name=job1
pbs.event().job.Resource_List[ncpus]=5
pbs.event().job.Resource_List[mem]=6mb
pbs.event().vnode_list["host1"].resources_available["ncpus"] =
5
pbs.event().vnode_list["host1"].resources_available["mem"] =
300gb
Available only when --hook option is used.
-L <log dir>β Directory holding the log file wherepbs.logmsg()andpbs.logjobmsg()write their output. Default is current working directory wherepbs_pythonis executed. Available only when--hookoption is used.-l <log file>β Log file wherepbs.logmsg()andpbs.logjobmsg()write their output. Default file name is current date inyyyymmddformat. Available only when--hookoption is used.-o <hook execution record>β The hook execution record contains the changes made after executing the hook script, such as the attributes and resources set in anypbs.event()jobs and reservations, whether an action was accepted or rejected, and anypbs.reject()messages.
Example hook execution record:
pbs.event().job.Job_Name=job2
pbs.event().job.Resource_List[file]=60gb
pbs.event().job.Resource_List[ncpus]=5
pbs.event().job.Resource_List[mem]=20gb
pbs.event().job.Account_Name=account2
pbs.event().reject=True
pbs.event().reject_msg=No way!
Without this option, output goes to stdout.
Available only when --hook option is used.
-r <resourcedef file>β File/path name containing a resource definition specifying a custom resource whose Python type ispbs.resource.
Format:
<resource name> type=<typename> [flag=<value>]
This file has the same format as the PBS_HOME/server_priv/resourcedef file. Available only when --hook option is used.
-s <site data file>β The site data file can contain any relevant information about the server, queues, vnodes, and jobs at the server. This file can be written by a hook or by the administrator.
When the hook writes it, this file contains the values that populate the server, queues, vnodes, reservations, and jobs, with all attributes and resources for which there are values.
The site data file is named hook_<event type>_<hook name>_<random integer>.data. Available only when --hook option is used.
--versionβ Thepbs_pythoncommand prints its version information and exits. This option can only be used alone.
π§ ARGUMENTS π§
<Python script>β The hook script to execute. We recommend importing the PBS Python module at the start of the script:
import pbs
If you do not specify Python script, you can perform interactive debugging. If you type the following:
pbs_python --hook -i hook.input
The interpreter displays a prompt:
>>
You can type your Python lines at the prompt:
>>import pbs
>> e=pbs.event().job
>> print e.id
<job ID>
okay bestie, that's the whole page. This one is tagged Local, dated 6 May 2020, and it's the pbs_python(1B) manual page β slay responsibly πβ¨
π¦ where this page comes from
- nixos 26.05: openpbs 23.06.06-unstable-2026-04-02
- nixpkgs unstable: openpbs 23.06.06-unstable-2026-04-02
- Copyright (C) 1994-2021 Altair Engineering, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms