pbs_module.7B 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. .\" Copyright (C) 1994-2018 Altair Engineering, Inc.
  2. .\" For more information, contact Altair at www.altair.com.
  3. .\"
  4. .\" This file is part of the PBS Professional ("PBS Pro") software.
  5. .\"
  6. .\" Open Source License Information:
  7. .\"
  8. .\" PBS Pro is free software. You can redistribute it and/or modify it under the
  9. .\" terms of the GNU Affero General Public License as published by the Free
  10. .\" Software Foundation, either version 3 of the License, or (at your option) any
  11. .\" later version.
  12. .\"
  13. .\" PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  14. .\" WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15. .\" FOR A PARTICULAR PURPOSE.
  16. .\" See the GNU Affero General Public License for more details.
  17. .\"
  18. .\" You should have received a copy of the GNU Affero General Public License
  19. .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. .\"
  21. .\" Commercial License Information:
  22. .\"
  23. .\" For a copy of the commercial license terms and conditions,
  24. .\" go to: (http://www.pbspro.com/UserArea/agreement.html)
  25. .\" or contact the Altair Legal Department.
  26. .\"
  27. .\" Altair’s dual-license business model allows companies, individuals, and
  28. .\" organizations to create proprietary derivative works of PBS Pro and
  29. .\" distribute them - whether embedded or bundled with other software -
  30. .\" under a commercial license agreement.
  31. .\"
  32. .\" Use of Altair’s trademarks, including but not limited to "PBS™",
  33. .\" "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  34. .\" trademark licensing policies.
  35. .\"
  36. .TH pbs_module 7B "20 April 2018" Local "PBS Professional"
  37. .SH NAME
  38. .B pbs_module
  39. \- Python interface to PBS and PBS hook environment
  40. .SH DESCRIPTION
  41. The
  42. .I pbs module
  43. provides an interface to PBS and the hook environment.
  44. The interface is made up of Python objects, which have attributes and
  45. methods. You can operate on these objects using Python code.
  46. For a description of each object, see the
  47. .I PBS Professional Administrator's Guide.
  48. .SH PBS MODULE OBJECTS
  49. .IP pbs.acl
  50. Represents a PBS ACL type.
  51. .IP pbs.args
  52. Represents a space-separated list of PBS arguments to commands like qsub, qdel.
  53. .IP pbs.argv[]
  54. Represents a list of argument strings to be passed to the program
  55. .IP pbs.BadAttributeValueError
  56. Raised when setting the attribute value of a pbs.* object to an invalid value.
  57. .IP pbs.BadAttributeValueTypeError
  58. Raised when setting the attribute value of a pbs.* object to an invalid value type.
  59. .IP pbs.BadResourceValueError
  60. Raised when setting the resource value of a pbs.* object to an invalid value.
  61. .IP pbs.BadResourceValueTypeError
  62. Raised when setting the resource value of a pbs.* object to an invalid value type.
  63. .IP pbs.checkpoint
  64. Represents a job's
  65. .I Checkpoint
  66. attribute.
  67. .IP pbs.depend
  68. Represents a job's
  69. .I depend
  70. attribute.
  71. .IP pbs.duration
  72. Represents a time interval.
  73. .IP pbs.email_list
  74. Represents the set of users to whom mail may be sent.
  75. .IP pbs.env[]
  76. Dictionary of environment variables.
  77. .IP pbs.event
  78. Represents a PBS event.
  79. .IP pbs.EventIncompatibleError
  80. Raised when referencing a non-existent attribute in pbs.event().
  81. .IP pbs.EXECHOST_PERIODIC
  82. The
  83. .I exechost_periodic
  84. event type.
  85. .IP pbs.EXECHOST_STARTUP
  86. The
  87. .I exechost_startup
  88. event type.
  89. .IP pbs.EXECJOB_ATTACH
  90. The
  91. .I execjob_attach
  92. event type.
  93. .IP pbs.EXECJOB_BEGIN
  94. The
  95. .I execjob_begin
  96. event type.
  97. .IP pbs.EXECJOB_END
  98. The
  99. .I execjob_end
  100. event type.
  101. .IP pbs.EXECJOB_EPILOGUE
  102. The
  103. .I execjob_epilogue
  104. event type.
  105. .IP pbs.EXECJOB_LAUNCH
  106. The
  107. .I execjob_launch
  108. event type.
  109. .IP pbs.EXECJOB_PRETERM
  110. The
  111. .I execjob_preterm
  112. event type.
  113. .IP pbs.EXECJOB_PROLOGUE
  114. The
  115. .I execjob_prologue
  116. event type.
  117. .IP pbs.exec_host
  118. Represents a job's
  119. .I exec_host
  120. attribute.
  121. .IP pbs.exec_vnode
  122. Represents a job's
  123. .I exec_vnode
  124. attribute.
  125. .IP pbs.group_list
  126. Represents a list of group names.
  127. .IP pbs.hold_types
  128. Represents a job's
  129. .I Hold_Types
  130. attribute.
  131. .IP pbs.hook_config_filename
  132. Contains path to hook's configuration file.
  133. .IP pbs.job
  134. Represents a PBS job.
  135. .IP pbs.job_list[]
  136. Represents a list of pbs.job objects.
  137. .IP pbs.job_sort_formula
  138. Represents the server's
  139. .I job_sort_formula
  140. attribute.
  141. .IP pbs.JOB_STATE_BEGUN
  142. Represents the job array state of having started.
  143. .IP pbs.JOB_STATE_EXITING
  144. Represents the job state of exiting.
  145. .IP pbs.JOB_STATE_EXPIRED
  146. Represents the subjob state of expiring.
  147. .IP pbs.JOB_STATE_FINISHED
  148. Represents the job state of finished.
  149. .IP pbs.JOB_STATE_HELD
  150. Represents the job state of held.
  151. .IP pbs.JOB_STATE_MOVED
  152. Represents the job state of moved.
  153. .IP pbs.JOB_STATE_QUEUED
  154. Represents the job state of queued.
  155. .IP pbs.JOB_STATE_RUNNING
  156. Represents the job state of running.
  157. .IP pbs.JOB_STATE_SUSPEND
  158. Represents the job state of suspended.
  159. .IP pbs.JOB_STATE_SUSPEND_USERACTIVE
  160. Represents the job state of suspended due to user activity.
  161. .IP pbs.JOB_STATE_TRANSIT
  162. Represents the job state of transiting.
  163. .IP pbs.JOB_STATE_WAITING
  164. Represents the job state of waiting.
  165. .IP pbs.join_path
  166. Represents a job's
  167. .I Join_Path
  168. attribute.
  169. .IP pbs.keep_files
  170. Represents a job's
  171. .I Keep_Files
  172. attribute.
  173. .IP pbs.license_count
  174. Represents a set of licensing-related counters.
  175. .IP pbs.LOG_DEBUG
  176. Log level 004.
  177. .IP pbs.LOG_ERROR
  178. Log level 004.
  179. .IP pbs.LOG_WARNING
  180. Log level 004.
  181. .IP pbs.mail_points
  182. Represents a job's
  183. .I Mail_Points
  184. attribute.
  185. .IP pbs.MODIFYJOB
  186. The
  187. .I modifyjob
  188. event type.
  189. .IP pbs.MOVEJOB
  190. The
  191. .I movejob
  192. event type.
  193. .IP pbs.ND_BUSY
  194. Represents
  195. .I busy
  196. vnode state.
  197. .IP pbs.ND_DEFAULT_EXCL
  198. Represents
  199. .I default_excl sharing
  200. vnode attribute value
  201. .IP pbs.ND_DEFAULT_SHARED
  202. Represents
  203. .I default_shared sharing
  204. vnode attribute value.
  205. .IP pbs.ND_DOWN
  206. Represents
  207. .I down
  208. vnode state
  209. .IP pbs.ND_FORCE_EXCL
  210. Represents
  211. .I force_excl sharing
  212. vnode attribute value.
  213. .IP pbs.ND_FREE
  214. Represents
  215. .I free
  216. vnode state.
  217. .IP pbs.ND_GLOBUS
  218. PBS no longer supports Globus. The Globus functionality has been
  219. .B removed
  220. from PBS.
  221. Represents
  222. .I globus
  223. vnode
  224. .I ntype.
  225. .IP pbs.ND_IGNORE_EXCL
  226. Represents
  227. .I ignore_excl sharing
  228. vnode attribute value.
  229. .IP pbs.ND_JOBBUSY
  230. Represents
  231. .I job-busy
  232. vnode state.
  233. .IP pbs.ND_JOB_EXCLUSIVE
  234. Represents
  235. .I job-exclusive
  236. vnode state.
  237. .IP pbs.ND_OFFLINE
  238. Represents
  239. .I offline
  240. vnode state.
  241. .IP pbs.ND_PBS
  242. Represents
  243. .I pbs
  244. vnode
  245. .I ntype.
  246. .IP pbs.ND_PROV
  247. Represents
  248. .I provisioning
  249. vnode state.
  250. .IP pbs.ND_RESV_EXCLUSIVE
  251. Represents
  252. .I resv-exclusive
  253. vnode state.
  254. .IP pbs.ND_STALE
  255. Represents
  256. .I stale
  257. vnode state.
  258. .IP pbs.ND_STATE_UNKNOWN
  259. Represents
  260. .I state-unknown, down
  261. vnode state.
  262. .IP pbs.ND_UNRESOLVABLE
  263. Represents the
  264. .I unresolvable
  265. vnode state.
  266. .IP pbs.ND_WAIT_PROV
  267. Represents
  268. .I wait-provisioning
  269. vnode state.
  270. .IP pbs.node_group_key
  271. Represents the server or queue
  272. .I node_group_key
  273. attribute.
  274. .IP pbs.path_list
  275. Represents a list of pathnames.
  276. .IP pbs.pbs_conf[]
  277. Dictionary of entries in pbs.conf.
  278. .IP pbs.pid
  279. Represents the process ID of a process belonging to a job.
  280. .IP pbs.place
  281. Represents the
  282. .I place
  283. job submission specification.
  284. .IP pbs.progname
  285. Path of job shell or executable.
  286. .IP pbs.QTYPE_EXECUTION
  287. The
  288. .I execution
  289. queue type.
  290. .IP pbs.QTYPE_ROUTE
  291. The
  292. .I route
  293. queue type.
  294. .IP pbs.queue
  295. Represents a PBS queue.
  296. .IP pbs.QUEUEJOB
  297. The
  298. .I queuejob
  299. event type.
  300. .IP pbs.range
  301. Represents a range of numbers referring to array indices.
  302. .IP pbs.resv
  303. Represents a PBS reservation.
  304. .IP pbs.RESVSUB
  305. The
  306. .I resvsub
  307. event type.
  308. .IP pbs.RESV_STATE_BEING_DELETED
  309. Represents the reservation state RESV_BEING_DELETED.
  310. .IP pbs.RESV_STATE_CONFIRMED
  311. Represents the reservation state RESV_CONFIRMED.
  312. .IP pbs.RESV_STATE_DEGRADED
  313. Represents the reservation state RESV_DEGRADED.
  314. .IP pbs.RESV_STATE_DELETED
  315. Represents the reservation state RESV_DELETED.
  316. .IP pbs.RESV_STATE_DELETING_JOBS
  317. Represents the reservation state RESV_DELETING_JOBS.
  318. .IP pbs.RESV_STATE_FINISHED
  319. Represents the reservation state RESV_FINISHED.
  320. .IP pbs.RESV_STATE_NONE
  321. Represents the reservation state RESV_NONE.
  322. .IP pbs.RESV_STATE_RUNNING
  323. Represents the reservation state RESV_RUNNING.
  324. .IP pbs.RESV_STATE_TIME_TO_RUN
  325. Represents the reservation state RESV_TIME_TO_RUN.
  326. .IP pbs.RESV_STATE_UNCONFIRMED
  327. Represents the reservation state RESV_UNCONFIRMED.
  328. .IP pbs.RESV_STATE_WAIT
  329. Represents the reservation state RESV_WAIT.
  330. .IP pbs.route_destinations
  331. Represents a queue's
  332. .I route_destinations
  333. attribute.
  334. .IP pbs.RUNJOB
  335. The
  336. .I runjob
  337. event type.
  338. .IP pbs.select
  339. Represents the
  340. .I select
  341. job submission specification.
  342. .IP pbs.server
  343. Represents the local PBS server.
  344. .IP pbs.size
  345. Represents a PBS
  346. .I size
  347. type.
  348. .IP pbs.software
  349. Represents a site-dependent software specification resource.
  350. .IP pbs.staging_list
  351. Represents a list of file stagein or stageout parameters.
  352. .IP pbs.state_count
  353. Represents a set of job-related state counters.
  354. .IP pbs.SV_STATE_ACTIVE
  355. Represents the server state "Scheduling".
  356. .IP pbs.SV_STATE_HOT
  357. Represents the server state "Hot_Start".
  358. .IP pbs.SV_STATE_IDLE
  359. Represents the server state "Idle".
  360. .IP pbs.SV_STATE_SHUTDEL
  361. Represents the server state "Terminating, Delayed".
  362. .IP pbs.SV_STATE_SHUTIMM
  363. Represents the server state "Terminating".
  364. .IP pbs.SV_STATE_SHUTSIG
  365. Represents the server state "Terminating", when a signal has been caught.
  366. .IP pbs.UnsetAttributeNameError
  367. Raised when referencing a non-existent name of a pbs.* object.
  368. .IP pbs.UnsetResourceNameError
  369. Raised when referencing a non-existent name of a pbs.* object.
  370. .IP pbs.user_list
  371. Represents a list of user names.
  372. .IP pbs.vchunk
  373. Represents a resource chunk assigned to a job.
  374. .IP pbs.version
  375. Represents PBS version information.
  376. .IP pbs.vnode
  377. Represents a PBS vnode.
  378. .IP pbs.vnode_list[]
  379. Represents a list of PBS vnodes.
  380. .IP SystemExit
  381. Raised when accepting or rejecting an action.
  382. .LP
  383. .SH PBS MODULE GLOBAL METHODS
  384. .IP pbs.acl("[+|-]<entity>][,...]")
  385. Creates an object representing a PBS ACL, using the given string parameter.
  386. Instantiation of these objects requires a formatted input string.
  387. .IP pbs.args("<args>")
  388. where
  389. .I <args>
  390. are space-separated arguments to a command such as
  391. .B qsub
  392. or
  393. .B qdel.
  394. Creates an object representing the arguments to the command.
  395. Example:
  396. .RS 10
  397. pbs.args("-Wsuppress_email=N -r y")
  398. .RE
  399. .IP
  400. Instantiation of these objects requires a formatted input string.
  401. .IP pbs.checkpoint("<checkpoint_string>")
  402. where
  403. .I <checkpoint_string>
  404. must be one of "n", "s", "c", "c=mmm", "w", or "w=mmm"
  405. Creates an object representing the job's
  406. .I Checkpoint
  407. attribute, using the given string.
  408. Instantiation of these objects requires a formatted input string.
  409. .IP pbs.depend("<depend_string>")
  410. .I <depend_string>
  411. must be of format "<type>:<jobid>[,<jobid>...]", or "on:<count>", and
  412. where
  413. .I <type>
  414. is one of "after", "afterok", "afterany", "before", "beforeok",
  415. and "beforenotok".
  416. Creates a PBS dependency specification object representing the job's
  417. .I depend
  418. attribute, using the given
  419. .I <depend_string>.
  420. Instantiation of these objects requires a formatted input string.
  421. .IP pbs.duration("[[hours:]minutes:]seconds[.milliseconds]")
  422. Creates a time specification duration instance, returning the
  423. equivalent number of seconds from the given time string. Represents an
  424. interval or elapsed time in number of seconds. Duration objects can be
  425. specified using either a time or an integer. See the
  426. "pbs.duration(<integer>)" creation method.
  427. .IP pbs.duration(<integer>)
  428. Creates an integer duration instance using the specified number of
  429. seconds. A
  430. .I pbs.duration
  431. instance can be operated on by any of the
  432. Python
  433. .I int
  434. functions. When performing arithmetic operations on a
  435. .I pbs.duration
  436. type, ensure the resulting value is a
  437. .I pbs.duration()
  438. type, before assigning to a job member that expects such a type.
  439. .IP pbs.email_list("<email_address1>[,<email_address2>...]")
  440. Creates an object representing a mail list.
  441. Instantiation of these objects requires a formatted input string.
  442. .IP pbs.exec_host("host/N[*C][+...]")
  443. Create an object representing the
  444. .I exec_host
  445. job attribute, using the
  446. given host and resource specification.
  447. Instantiation of these objects requires a formatted input string.
  448. .IP pbs.exec_vnode("<vchunk>[+<vchunk>...]")
  449. .I <vchunk>
  450. is (<vnodename:ncpus=N:mem=M>)
  451. Creates an object representing the
  452. .I exec_vnode
  453. job attribute, using the
  454. given vnode and resource specification. When the
  455. .B qrun -H
  456. command is used, or when the scheduler runs a job, the
  457. .I pbs.job.exec_vnode
  458. object contains the vnode specification for the job. Instantiation of these
  459. objects requires a formatted input string.
  460. .br
  461. Example:
  462. .br
  463. pbs.exec_vnode("(vnodeA:ncpus=N:mem=X)+(nodeB:ncpus=P:mem=Y+nodeC:mem=Z)")
  464. .br
  465. This object is managed and accessed via the
  466. .I str()
  467. or
  468. .I repr()
  469. functions.
  470. .br
  471. Example:
  472. .br
  473. Python> ev = pbs.server().job("10").exec_vnode
  474. .br
  475. Python> str(ev)
  476. .br
  477. "(vnodeA:ncpus=2:mem=200m)+(vnodeB:ncpus=5:mem=1g)"
  478. .IP pbs.get_hook_config_file()
  479. Returns the path to the hook's configuration file, or None if there is
  480. no configuration file. For example:
  481. .RS 10
  482. configfilepath = pbs.get_hook_config_file()
  483. .RE
  484. .IP pbs.get_local_nodename()
  485. This returns a Python str whose value is the name of the local natural vnode.
  486. If you want to refer to the vnode object representing the current
  487. host, you can pass this vnode name as the key to
  488. .I pbs.event().vnode_list[].
  489. For example:
  490. .RS 10
  491. Vn = pbs.event().vnode_list[pbs.get_local_nodename()]
  492. .RE
  493. .IP pbs.get_pbs_conf()
  494. This method returns a dictionary of values which represent entries in
  495. the pbs.conf file. The method reads the file on the host where a hook
  496. runs, so pre-execution event hooks get the entries on the server host,
  497. and execution event hooks get the entries on the execution host where
  498. the hook runs. The method reads /etc/pbs.conf on the host where
  499. pbs_python runs.
  500. Example:
  501. .RS 10
  502. pbs_conf = pbs.get_pbs_conf()
  503. .br
  504. pbs.logmsg(pbs.LOG_DEBUG, "pbs home is " % (pbs_conf['PBS_HOME]))
  505. .RE
  506. .IP
  507. If you HUP pbs_mom (Linux/UNIX), pbs.get_pbs_conf returns the reloaded
  508. contents of the pbs.conf file.
  509. .IP pbs.group_list("<group_name>[@<host>][,<group_name>[@<host>]...]")
  510. Creates an object representing a PBS group list.
  511. To use a group list object:
  512. .br
  513. pbs.job.group_list = pbs.group_list(....)
  514. .br
  515. Instantiation of these objects requires a formatted input string.
  516. .IP pbs.hold_types("<hold_type_str>")
  517. where
  518. .I <hold_type_str>
  519. is one of "u", "o", "s", or "n".
  520. Creates an object representing the
  521. .I Hold_Types
  522. job attribute.
  523. Instantiation of these objects requires a formatted input string.
  524. .IP pbs.job_sort_formula("<formula_string>")
  525. where
  526. .I <formula_string>
  527. is a string containing a math formula.
  528. Creates an object representing the
  529. .I job_sort_formula
  530. server attribute.
  531. Instantiation of these objects requires a formatted input string.
  532. .IP pbs.join_path({"oe"|"eo"|"n"})
  533. Creates an object representing the
  534. .I Join_Path
  535. job attribute.
  536. Instantiation of these objects requires a formatted input string.
  537. .IP pbs.keep_files("<keep_files_str>")
  538. where
  539. .I <keep_files_str>
  540. is one of "o", "e", "oe", "eo".
  541. Creates an object representing the
  542. .I Keep_Files
  543. job attribute.
  544. Instantiation of these objects requires a formatted input string.
  545. .IP pbs.license_count("Avail_Global:<W>Avail_Local:<X>Used:<Y>High_Use:<Z>")
  546. Instantiates an object representing a
  547. .I license_count
  548. attribute.
  549. Instantiation of these objects requires a formatted input string.
  550. .IP pbs.logjobmsg(job_ID,message)
  551. where
  552. .I job_ID
  553. must be an existing or previously existing job ID and where
  554. .I message
  555. is an arbitrary string. This puts a custom string in the PBS Server
  556. log. The
  557. .B tracejob
  558. command can be used to print out the job-related
  559. messages logged by a hook script. Messages are logged at log event
  560. class
  561. .I pbs.LOG_DEBUG.
  562. .IP pbs.logmsg(log_event_class,message)
  563. where
  564. .I message
  565. is an arbitrary string, and where
  566. .I log_event_class
  567. can be one of the message log event class constants:
  568. .br
  569. pbs.LOG_WARNING
  570. .br
  571. pbs.LOG_ERROR
  572. .br
  573. pbs.LOG_DEBUG
  574. .br
  575. This puts a custom string in the daemon log.
  576. .IP pbs.mail_points("<mail_points_string>")
  577. where
  578. .I <mail_points_string>
  579. is "a", "b", and/or "e", or "n".
  580. Creates an object representing a
  581. .I Mail_Points
  582. attribute.
  583. Instantiation of these objects requires a formatted input string.
  584. .IP pbs.node_group_key("<resource>")
  585. Creates an object representing the resource to be used for node
  586. grouping, using the specified resource.
  587. .IP pbs.path_list("<path>[@<host>][,<path>@<host>...]")
  588. Creates an object representing a PBS pathname list.
  589. To use a path list object:
  590. .br
  591. pbs.job.Shell_Path_List = pbs.path_list(....)
  592. .br
  593. Instantiation of these objects requires a formatted input string.
  594. .IP pbs.env()
  595. Creates an empty environment variable list. For example, to create
  596. an empty environment variable list:
  597. .RS 10
  598. pbs.event().env = pbs.pbs_env()
  599. .RE
  600. .IP pbs.place("[arrangement]:[sharing]:[group]")
  601. .I arrangement
  602. can be "pack", "scatter", "free", "vscatter"
  603. .br
  604. .I sharing
  605. can be "shared", "excl", "exclhost"
  606. .br
  607. .I group
  608. can be of the form "group=<resource>"
  609. .br
  610. .I [arrangement], [sharing],
  611. and
  612. .I [group]
  613. can be given in any order or combination.
  614. .br
  615. Creates a place object representing the job's place specification.
  616. Instantiation of these objects requires a formatted input string.
  617. .br
  618. Example:
  619. .br
  620. pl = pbs.place("pack:excl")
  621. .br
  622. s = repr(pl) (or s = `pl`)
  623. .br
  624. letter = pl[0] (assigns 'p' to letter)
  625. .br
  626. s = s + ":group=host" (append to string)
  627. br
  628. pl = pbs.place(s) (update original pl)
  629. .IP pbs.range("<start>-<stop>:<step>")
  630. Creates a PBS object representing a range of values.
  631. .br
  632. Example:
  633. .br
  634. pbs.range("1-30:3")
  635. .br
  636. Instantiation of these objects requires a formatted input string.
  637. .IP pbs.reboot([<command>])
  638. This stops hook execution, so that remaining lines in the hook script
  639. are not executed, and starts the tasks that would normally begin after
  640. the hook is finished, such as flagging the current host to be
  641. rebooted. The MoM logs show the following:
  642. .RS 10
  643. <hook name> requested for host to be rebooted
  644. .RE
  645. .IP
  646. We recommend that before calling pbs.reboot(), you set any vnodes
  647. managed by this MoM offline, and requeue the current job, if this hook
  648. is not an exechost_periodic hook. For example:
  649. .RS 10
  650. for v in pbs.event().vnode_list.keys():
  651. .br
  652. \ \ \ pbs.event().vnode_list[v].state = pbs.ND_OFFLINE
  653. .br
  654. \ \ \ pbs.event().vnode_list[v].comment = "MoM host rebooting"
  655. .br
  656. pbs.event().job.rerun()
  657. .br
  658. pbs.reboot()
  659. .RE
  660. .IP
  661. The effect of the call to pbs.reboot() is not instantaneous. The
  662. reboot happens after the hook executes, and after any of the other
  663. actions such as pbs.event().job.rerun(), pbs.event().delete(), and
  664. pbs.event().vnode_list[] take effect.
  665. A hook with its user attribute set to pbsuser cannot successfully
  666. invoke pbs.reboot(), even if the owner is a PBS Manager or Operator.
  667. If this is attempted, the host is not rebooted, and the following
  668. message appears at log event class PBSEVENT_DEBUG2 in the MoM logs:
  669. .RS 10
  670. <hook_name>; Not allowed to issue reboot if run as user.
  671. .RE
  672. .IP
  673. The <command> is an optional argument. It is a Python str which is
  674. executed instead of the reboot command that is the default for the
  675. system. For example:
  676. .RS 10
  677. pbs.reboot("/usr/local/bin/my_reboot -s 10 -c 'going down in 10'")
  678. .RE
  679. .IP
  680. The specified <command> is executed in a shell on Linux/UNIX or via cmd on Windows.
  681. .IP pbs.route_destinations("<queue_spec>[,<queue_spec>,...]")
  682. where
  683. .I <queue_spec>
  684. is queue_name[@server_host[:port]]
  685. .br
  686. Creates an object that represents a
  687. .I route_destinations
  688. routing queue attribute.
  689. Instantiation of these objects requires a formatted input string.
  690. .IP pbs.select("[N:]res=val[:res=val][+[N:]res=val[:res=val]...]")
  691. Creates a
  692. .I select
  693. object representing the job's select specification.
  694. Instantiation of these objects requires a formatted input string.
  695. Example:
  696. .br
  697. sel = pbs.select("2:ncpus=1:mem=5gb+3:ncpus=2:mem=5gb")
  698. .br
  699. s = repr(sel) (or s = `sel`)
  700. .br
  701. letter = s[3] (assigns 'c' to letter)
  702. .br
  703. s = s + "+5:scratch=10gb" (append to string)
  704. .br
  705. sel = pbs.select(s) (reset the value of sel)
  706. .br
  707. .IP pbs.size(<integer>)
  708. Creates a PBS
  709. .I size
  710. object using the given integer value, storing the
  711. value as the number of bytes. Size objects can be specified using
  712. either an integer or a string. See the "pbs.size("<integer><suffix>")"
  713. creation method.
  714. .IP pbs.size("<integer><suffix>")
  715. Creates a PBS
  716. .I size
  717. object out of the given string specification.
  718. See the
  719. .I PBS Professional Reference Guide
  720. for suffix information.
  721. The size of a word
  722. is the word size on the execution host.
  723. .I Size
  724. objects can be specified
  725. using either an integer or a string. To operate on
  726. .I pbs.size
  727. instances, use the "+" and "-" operators. To compare
  728. .I pbs.size
  729. instances, use the "==", "!=", ">", "<", ">=", and "<=" operators.
  730. Example: the sizes are normalized to the smaller of the 2 suffixes. In
  731. this case, "10gb" becomes "10240mb" and is added to "10mb":
  732. .br
  733. sz = pbs.size("10gb")
  734. .br
  735. sz = sz + 10mb
  736. .br
  737. 10250mb
  738. .br
  739. Example: the following returns
  740. .I True
  741. because
  742. .I sz
  743. is greater than 100 bytes:
  744. .br
  745. if sz > 100:
  746. .br
  747. \ \ \ \ gt100 = True
  748. .br
  749. .IP pbs.software("<software_info_string>")
  750. Creates an object representing a site-dependent software resource.
  751. Instantiation of these objects requires a formatted input string.
  752. .IP pbs.staging_list("<filespec>[,<filespec>,...]")
  753. where
  754. .I <filespec>
  755. is <execution_path>@<storage_host>:<storage_path>
  756. Creates an object representing a job file staging parameters list.
  757. To use a staging list object:
  758. .br
  759. pbs.job.stagein = pbs.staging_list(....)
  760. .br
  761. Instantiation of these objects requires a formatted input string.
  762. .IP pbs.state_count("Transit:<U>Queued:<V>Held:<W>Running:<X>Exiting:<Y>Begun:<Z>)
  763. Instantiates an object representing a
  764. .I state_count
  765. attribute.
  766. Instantiation of these objects requires a formatted input string.
  767. .IP pbs.user_list("<user>[@<host>][,<user>@<host>...]")
  768. Creates an object representing a PBS user list.
  769. To use a user list object:
  770. .br
  771. pbs.job.User_List = pbs.user_list(....)
  772. .br
  773. Instantiation of these objects requires a formatted input string.
  774. .IP pbs.version("<pbs_version_string>")
  775. Creates an object representing the PBS version string.
  776. Instantiation of these objects requires a formatted input string.
  777. .SH ATTRIBUTES AND RESOURCES
  778. .br
  779. Hooks can read Server, Queue, or reservation resources.
  780. Hooks can read vnode or job attributes and resources. Hooks can modify
  781. .IP
  782. The resources requested by a job
  783. .br
  784. The resources used by a job
  785. .br
  786. The attributes of a job
  787. .br
  788. The resource arguments to pbs_rsub
  789. .br
  790. Vnode attributes and resources
  791. .br
  792. The shell or program to be executed in a job
  793. .br
  794. The arguments to the shell or program to be executed in a job
  795. .br
  796. The environment of the job
  797. .LP
  798. Custom and built-in PBS resources are represented in Python dictionaries,
  799. where the resource names are the dictionary keys. Built-in resources are
  800. listed in pbs_resources(7B). You reference a resource through a vnode,
  801. the Server, the event that triggered the hook, or the current job, for example:
  802. .IP
  803. pbs.server().resources_available["< resource name>"]
  804. .br
  805. pbs.event().job.Resource_List["< resource name>"]
  806. .br
  807. pbs.event().vnode_list[<vnode name>].resources_available["< resource name >"]
  808. .LP
  809. The resource name must be in quotes.
  810. Example: Get the number of CPUs:
  811. .IP
  812. ncpus = Resource_List["ncpus"]
  813. .LP
  814. An instance R of a job resource can be set as follows:
  815. .IP
  816. R["<resource name>"] = <resource value>
  817. .LP
  818. For example:
  819. .IP
  820. pbs.event().job().Resource_List["mem"] = 8gb
  821. .LP
  822. .SH EXCEPTIONS
  823. .IP pbs.BadAttributeValueError
  824. Raised when setting the attribute value of a pbs.* object to an invalid value.
  825. .IP pbs.BadAttributeValueTypeError
  826. Raised when setting the attribute value of a pbs.* object to an invalid value type.
  827. .IP pbs.BadResourceValueError
  828. Raised when setting the resource value of a pbs.* object to an invalid value.
  829. .IP pbs.BadResourceValueTypeError
  830. Raised when setting the resource value of a pbs.* object to an invalid value type.
  831. .IP pbs.EventIncompatibleError
  832. Raised when referencing a non-existent attribute in pbs.event().
  833. .IP pbs.UnsetAttributeNameError
  834. Raised when referencing a non-existent name of an attribute.
  835. .IP pbs.UnsetResourceNameError
  836. Raised when referencing a non-existent name of a resource.
  837. .IP SystemExit
  838. Raised when accepting or rejecting an action.
  839. .LP
  840. If a hook encounters an unhandled exception:
  841. .IP
  842. PBS rejects the corresponding action, and an error message is printed
  843. to stderr.
  844. .br
  845. A message is printed to the daemon log.
  846. .LP
  847. .SH SEE ALSO
  848. The
  849. .I PBS Professional Administrator's Guide,
  850. .br
  851. pbs_hook_attributes(7B), pbs_resources(7B),
  852. qmgr(1B)