pbs_rescquery.3B 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. .\"
  2. .\" Copyright (C) 1994-2018 Altair Engineering, Inc.
  3. .\" For more information, contact Altair at www.altair.com.
  4. .\"
  5. .\" This file is part of the PBS Professional ("PBS Pro") software.
  6. .\"
  7. .\" Open Source License Information:
  8. .\"
  9. .\" PBS Pro is free software. You can redistribute it and/or modify it under the
  10. .\" terms of the GNU Affero General Public License as published by the Free
  11. .\" Software Foundation, either version 3 of the License, or (at your option) any
  12. .\" later version.
  13. .\"
  14. .\" PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  15. .\" WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. .\" FOR A PARTICULAR PURPOSE.
  17. .\" See the GNU Affero General Public License for more details.
  18. .\"
  19. .\" You should have received a copy of the GNU Affero General Public License
  20. .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. .\"
  22. .\" Commercial License Information:
  23. .\"
  24. .\" For a copy of the commercial license terms and conditions,
  25. .\" go to: (http://www.pbspro.com/UserArea/agreement.html)
  26. .\" or contact the Altair Legal Department.
  27. .\"
  28. .\" Altair’s dual-license business model allows companies, individuals, and
  29. .\" organizations to create proprietary derivative works of PBS Pro and
  30. .\" distribute them - whether embedded or bundled with other software -
  31. .\" under a commercial license agreement.
  32. .\"
  33. .\" Use of Altair’s trademarks, including but not limited to "PBS™",
  34. .\" "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  35. .\" trademark licensing policies.
  36. .\"
  37. .if \n(Pb .ig Ig
  38. .TH pbs_rescquery 3B "1 Oct 2009" Local "PBS Professional"
  39. .\" The following macros are style for object names and values.
  40. .de Ar \" command/function arguments and operands (italic)
  41. .ft 2
  42. .if \\n(.$>0 \&\\$1\f1\\$2
  43. ..
  44. .de Av \" data item values (Helv)
  45. .if \n(Pb .ft 6
  46. .if !\n(Pb .ft 3
  47. .ps -1
  48. .if \\n(.$>0 \&\\$1\s+1\f1\\$2
  49. ..
  50. .de At \" attribute and data item names (Helv Bold)
  51. .if \n(Pb .ft 6
  52. .if !\n(Pb .ft 2
  53. .ps -1
  54. .if \\n(.$>0 \&\\$1\s+1\f1\\$2
  55. ..
  56. .de Ty \" Type-ins and examples (typewriter)
  57. .if \n(Pb .ft 5
  58. .if !\n(Pb .ft 3
  59. .if \\n(.$>0 \&\\$1\f1\\$2
  60. ..
  61. .de Er \" Error values ( [Helv] )
  62. .if \n(Pb .ft 6
  63. .if !\n(Pb .ft 3
  64. \&\s-1[\^\\$1\^]\s+1\f1\\$2
  65. ..
  66. .de Sc \" Symbolic constants ( {Helv} )
  67. .if \n(Pb .ft 6
  68. .if !\n(Pb .ft 3
  69. \&\s-1{\^\\$1\^}\s+1\f1\\$2
  70. ..
  71. .de Al \" Attribute list item, like .IP but set font and size
  72. .if !\n(Pb .ig Ig
  73. .ft 6
  74. .IP "\&\s-1\\$1\s+1\f1"
  75. .Ig
  76. .if \n(Pb .ig Ig
  77. .ft 2
  78. .IP "\&\\$1\s+1\f1"
  79. .Ig
  80. ..
  81. .\" the following pair of macros are used to bracket sections of code
  82. .de Cs
  83. .ft 5
  84. .nf
  85. ..
  86. .de Ce
  87. .sp
  88. .fi
  89. .ft 1
  90. ..
  91. .\" End of macros
  92. .Ig
  93. .SH NAME
  94. pbs_rescquery, avail, totpool, usepool - query resource availability
  95. .SH SYNOPSIS
  96. #include <pbs_error.h>
  97. .br
  98. #include <pbs_ifl.h>
  99. .sp
  100. .ft 3
  101. .nf
  102. int pbs_rescquery\^(\^int\ connect, char\ **resourcelist, int *arraysize,
  103. int *available, int *allocated, int *reserved, int *down \^)
  104. .sp
  105. char *avail\^(\^int connect, char *resc\^)
  106. .sp
  107. int totpool\^(\^int connect, int update\^)
  108. .sp
  109. int usepool\^(\^int connect, int update\^)
  110. .fi
  111. .ft 1
  112. .SH DESCRIPTION
  113. .if \n(Pb .ig Ig
  114. .HP 2
  115. .Ig
  116. .if !\n(Pb .ig Ig
  117. .sp
  118. .Ig
  119. .B pbs_rescquery
  120. .br
  121. Issue a request to the batch server to query the availability of resources.
  122. .Ar connect
  123. is the connection returned by \f3pbs_connect\fP().
  124. .Ar resourcelist
  125. is an array of one or more strings specifying the resources to be queried.
  126. .Ar arraysize
  127. is the is the number of strings in resourcelist.
  128. .Ar available ,
  129. .Ar allocated ,
  130. .Ar reserved ,
  131. and
  132. .Ar down
  133. are integer arrays of size arraysize. The amount of resource specified in
  134. the corresponding resourcelist string which is available, already allocated,
  135. reserved, and down/off-line is returned in the integer arrays.
  136. .IP
  137. At the present time the only resources which may be specified is "nodes".
  138. It may be specified as
  139. .br
  140. .Ty \ \ \ \ nodes
  141. .br
  142. .Ty \ \ \ \ nodes=
  143. .br
  144. .Ty \ \ \ \ nodes=\f2specification\f1
  145. .br
  146. where specification is what a user specifies in the -l option argument list
  147. for nodes. See the qsub(1B) and pbs_resources(7B) man pages.
  148. .IP
  149. Where the node resourcelist is a simple type, such as "nodes", "nodes=",
  150. or "nodes=\f2type\fP", the numbers returned reflect the actual number of nodes
  151. (of the specified type) which are \f2available\fP, \f2allocated\fP,
  152. \f2reserved\fP, or \f2down\fP.
  153. .IP
  154. For a more complex node resourcelist, such as
  155. "nodes=2" or "nodes=type1:type2", only the value returned in
  156. .I available
  157. has meaning.
  158. If the number in
  159. .I available
  160. is positive, it is the number of nodes required to satisfy the specification
  161. and that some set of nodes are available which will satisfy it, see
  162. .I avail ().
  163. If the number in
  164. .I available
  165. is zero, some number of nodes required for the specification are
  166. currently unavailable, the request might be satisfied at a later time.
  167. If the number in
  168. .I available
  169. is negative, no combination of known nodes can fulfill the specification.
  170. .if \n(Pb .ig Ig
  171. .HP 2
  172. .Ig
  173. .if !\n(Pb .ig Ig
  174. .sp
  175. .Ig
  176. .B avail
  177. .br
  178. The
  179. .I avail ()
  180. call is provided as a conversion aid for schedulers written for early versions
  181. of PBS. The avail() routine uses pbs_rescquery() and returns a character
  182. string answer.
  183. .Ar connect
  184. is the connection returned by \f3pbs_connect\fP().
  185. .Ar resc
  186. is a single
  187. .I node=specification
  188. specification as discussed above. If the nodes to satisfy the specification
  189. are currently available, the return value is the character string
  190. .B yes .
  191. If the nodes are currently unavailable, the return is the character string
  192. .B no .
  193. If the specification could never be satisfied, the return is the string
  194. .B never .
  195. An error in the specification returns the character string
  196. .B ? .
  197. .if \n(Pb .ig Ig
  198. .HP 2
  199. .Ig
  200. .if !\n(Pb .ig Ig
  201. .sp
  202. .Ig
  203. .B totpool
  204. .br
  205. The
  206. .I totpool ()
  207. function returns the total number of nodes known to the PBS server. This is
  208. the sum of the number of nodes available, allocated, reserved, and down.
  209. The parameter
  210. .Ar connection
  211. is the connection returned by pbs_connect().
  212. The parameter
  213. .Ar update
  214. if non-zero, causes totpool() to issue a pbs_rescquery() call to obtain
  215. fresh information. If zero, numbers from the prior pbs_rescquery() are used.
  216. .if \n(Pb .ig Ig
  217. .HP 2
  218. .Ig
  219. .if !\n(Pb .ig Ig
  220. .sp
  221. .Ig
  222. .B usepool
  223. .br
  224. .I usepool ()
  225. returns the number of nodes currently in use, the sum of allocated, reserved,
  226. and down.
  227. The parameter
  228. .Ar connection
  229. is the connection returned by pbs_connect().
  230. The parameter
  231. .Ar update
  232. if non-zero, causes totpool() to issue a pbs_rescquery() call to obtain
  233. fresh information. If zero, numbers from the prior pbs_rescquery() are used.
  234. .SH "SEE ALSO"
  235. qsub(1B), pbs_connect(3B), pbs_disconnect(3B), pbs_rescreserve(3B) and
  236. pbs_resources(7B)
  237. .SH DIAGNOSTICS
  238. When the batch request generated by the \f3pbs_rescquery\f1()
  239. function has been completed successfully
  240. by a batch server, the routine will return 0 (zero).
  241. Otherwise, a non zero error is returned. The error number is also set
  242. in pbs_errno.
  243. .LP
  244. The functions usepool() and totpool() return -1 on error.