caveats.rst 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. Caveats
  2. =======
  3. Standing reservation PBS_TZID
  4. -----------------------------
  5. Standing reservations cannot be submitted using the API interface alone due
  6. to the need to set the PBS_TZID environment variable, such reservations are
  7. always submitted using a CLI.
  8. qmgr operations for hooks and formula
  9. -------------------------------------
  10. Qmgr operations for hooks and for the job_sort_formula must be done as root,
  11. they are performed over the CLI.
  12. CLI and API differences
  13. -----------------------
  14. PTL redefines the PBS IFL such that it can dynamically call them via either
  15. the API or the CLI. The methods are typically named after their PBS IFL
  16. counterpart omitting the `pbs_` prefix, for example pbs_manager() becomes
  17. manager() in PTL. Each method will typically either return the return code
  18. of its API/CLI counterpart, or raise a specific PTL exception. In some cases
  19. (e.g. manager) the return value may be that of the call to the expect() method.
  20. When calling expect on an attribute value, the value may be different
  21. depending on whether the library is operating in CLI or API mode; as an
  22. example, when submitting a reservation, expecting it to be confirmed via the
  23. API calls for an expect of {'reserve_state':'2'} whereas using the CLI one
  24. would expect {'reserve_state':'RESV_CONFIRMED'}.
  25. This can be handled in several ways:
  26. The preferred way is to use the MATCH_RE operation on the attribute and
  27. check for either one of the possible values: for example to match either
  28. RESV_CONFIRMED or 2 one can write::
  29. Server().expect(RESV, {'reserve_state':(MATCH_RE,"RESV_CONFIRMED|2")})
  30. An alternative way is to set the operating mode to the one desired at the
  31. beginning of the test (to one of PTL_API, or PTL_CLI) and ensure it is set
  32. accordingly by calling get_op_mode(), or handle the response in the test by
  33. checking if the operating mode is CLI or API, which is generally speaking
  34. more robust and the favored approach as the automation may be run in either
  35. mode on different systems.
  36. List (non-exhaustive) of attribute type differences between CLI and API:
  37. - reserve_state
  38. - all times: ctime, mtime, qtime, reserve_start, reserve_end, estimated.start_time, Execution_Time
  39. Creating temp files
  40. -------------------
  41. When creating temp files, favor the use of DshUtils().mkstemp
  42. Unsetting attributes
  43. --------------------
  44. To unset attributes in alterjob, set the attribute value to '' (two single
  45. quotes) in order to escape special quote handling in Popen.
  46. Example::
  47. obj.unset_attributes([ATTR_Arglist])
  48. Stat'ing objects via db-access
  49. ------------------------------
  50. Not all object attributes are written to the DB, as a result, when using
  51. pbs_stat with db-access enabled, information may appear to be missing.
  52. Scheduler holidays file handling
  53. --------------------------------
  54. When reverting scheduler's default configuration, the holidays file is
  55. reverted only if it was specifically parsed, either by calling parse_holidays
  56. or by calling set_prime_time, to the contents of the file first parsed. In
  57. other words, if the contents of the file were updated outside PbsTestLab, and
  58. edited in PbsTestLab, the file will be reverted to that version rather than
  59. the vanilla file that ships with PBS Pro.
  60. Interactive Jobs
  61. ----------------
  62. Interactive jobs are only supported through CLI operations and require the
  63. pexpect module to be installed.
  64. Interactive Jobs are submitted as a thread that sets the jobid as soon as it
  65. is returned by qsub -I, such that the caller can get back to monitoring
  66. the state of PBS while the interactive session goes on in the thread.
  67. The commands to be run within an interactive session are specified in the
  68. job's interactive_script attribute as a list of tuples, where the first
  69. item in each tuple is the command to run, and the subsequent items are
  70. the expected returned data.
  71. .. topic:: Implementation details:
  72. The submission of an interactive job requires passing in job attributes,
  73. the command to execute (i.e. path to qsub -I), the hostname and a
  74. user-to-password map, details follow:
  75. On Linux/Unix:
  76. - when not impersonating:
  77. pexpect spawns the qsub -I command and expects a prompt back, for each
  78. tuple in the interactive_script, it sends the command and expects to
  79. match the return value.
  80. - when impersonating:
  81. pexpect spawns sudo -u <user> qsub -I. The rest is as described in
  82. non-impersonating mode.