How do you access the account information from hook

I have added an account code to my submission script:

#PBS -A TEST_CODE

but when I print out the job info inside a hook:

e = pbs.event()
j = e.job

then print
j.__str__()

The account code I added isn’t there.

Where is it stored? And more broadly, where are the docs for the pbs module?

Thanks

Please try this
e = pbs.event()
j = pbs.event().job
account=j.Account_Name
pbs.logmsg(pbs.EVENT_DEBUG2,“my Account_Name is: %s”%account)

Please refer: https://www.altair.com/pdfs/pbsworks/PBSHooks2021.1.pdf

Thanks @adarsh.

It seems there is another hook that is setting the project with:

    setObjectAttr(job, "project", project)
    setObjectAttr(job, "Account_Name", project)

So the project code in the script is not being picked up.
Is there a way to override this setting, and make the project code get picked up?

The other hook is imported, and I’m not sure where the original file was left by the person that wrote it.

Or is it OK to edit the *.PY file for that hook directly?

Check the order of that hook setting the Project/Account Name, create another hook which runs after this hook (if the other hook is order 3, make your hook order 4)

You can qmgr: list hooks @default, get the name of the hook and you can find that hook in this location $PBS_HOME/server_priv/hooks

Not recommended to edit hook directly. It is better to copy that hook source from $PBS_HOME/server_priv/hooks and re-import it, so that PBS Server can propogate the changes (where required to PBS Moms).

Great - thanks @adarsh - I’ll give that a go!

See Chapter 3, “Quick Start with Hooks”, in the PBS Hooks Guide.

1 Like