pbs_selstat.3B 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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_selstat 3B "1 February 2016" Local "PBS Professional"
  37. .SH NAME
  38. pbs_selstat - obtain status of selected PBS batch jobs
  39. .SH SYNOPSIS
  40. #include <pbs_error.h>
  41. .br
  42. #include <pbs_ifl.h>
  43. .sp
  44. .B struct batch_status *pbs_selstat(\^int\ connect, struct\ attropl\ *sel_list,
  45. .B struct\ attrl\ *rattrib, char *extend\^)
  46. .sp
  47. .B void pbs_statfree(\^struct batch_status *psj\^)
  48. .SH DESCRIPTION
  49. Issue a batch request to examine the status of jobs which meet certain criteria.
  50. \f3pbs_selstat\f1() returns a list of batch_status structures for those jobs
  51. which met the selection criteria.
  52. .LP
  53. The
  54. .B sel_list
  55. struct holds the selection criteria. The
  56. .B rattrib
  57. struct holds the list of attributes whose values are to be returned.
  58. .LP
  59. This function is a combination of \f3pbs_selectjob\f1() and
  60. \f3pbs_statjob\f1().
  61. It is an extension to the POSIX Batch standard.
  62. .LP
  63. Initially all batch jobs are selected for which the user is authorized to
  64. query status.
  65. This set may be reduced or filtered by specifying certain attributes
  66. of the jobs.
  67. .LP
  68. A
  69. .I "Select Status"
  70. batch request is generated and sent to the server over the connection
  71. specified by
  72. .I connect
  73. which is the return value of \f3pbs_connect\f1().
  74. .LP
  75. The parameter,
  76. .I sel_list ,
  77. is a pointer to an
  78. .I attropl
  79. structure which is defined in pbs_ifl.h as:
  80. .sp
  81. .Ty
  82. .nf
  83. struct attropl {
  84. struct attropl *next;
  85. char *name;
  86. char *resource;
  87. char *value;
  88. enum batch_op op;
  89. };
  90. .fi
  91. .sp
  92. The
  93. .I sel_list
  94. list is terminated by the first entry where
  95. .I next
  96. is a null pointer.
  97. .LP
  98. The
  99. .I name
  100. member points to a string which is the name of the attribute.
  101. Not all of the job attributes may be used as a selection criteria.
  102. The
  103. .I resource
  104. member points to a string which is the name of a resource. This
  105. member is only used when
  106. .I name
  107. is set to ATTR_l,
  108. otherwise it should be a pointer to a null string.
  109. The
  110. .I value
  111. member points to a string which is the value of the attribute or resource.
  112. The attribute names are listed in pbs_job_attributes.7B.
  113. .br
  114. .LP
  115. The
  116. .I op
  117. member defines the operator in the logical expression:
  118. .br
  119. .B \ \ \ \ value\ operator\ current_value
  120. .br
  121. The logical expression must evaluate as true for the job to be selected.
  122. The permissible values of
  123. .I op
  124. are defined in pbs_ifl.h as:
  125. .RS 4
  126. .I "enum batch_op { ..., EQ, NE, GE, GT, LE, LT, ... };" .
  127. .RE
  128. The attributes marked with (E) in the description above may only be selected
  129. with the equal, EQ, or not equal, NE, operators.
  130. .LP
  131. If
  132. .I sel_list
  133. itself is a null pointer, then no selection is done on
  134. the basis of attributes.
  135. .LP
  136. The parameter,
  137. .I rattrib ,
  138. is a pointer to an
  139. .I attrl
  140. structure which is defined below.
  141. The
  142. .I rattrib
  143. list is terminated by the first entry where
  144. .I next
  145. is a null pointer. If
  146. .I attrib
  147. is given, then only the attributes in the list are returned by the server.
  148. Otherwise, all the attributes of a job are returned.
  149. When an
  150. .I attrib
  151. list is specified, the
  152. .I name
  153. member is a pointer to a attribute name as listed in pbs_alter(3) and
  154. pbs_submit(3). The
  155. .I resource
  156. member is only used if the name member is ATTR_l, otherwise it should be a
  157. pointer to a null string.
  158. The
  159. .I value
  160. member should always be a pointer to a null string.
  161. .LP
  162. The return value is a pointer to a list of
  163. .I batch_status
  164. structures or the null pointer if no jobs can be queried for status.
  165. The batch_status structure is defined in pbs_ifl.h as
  166. .sp
  167. .Ty
  168. .nf
  169. struct batch_status {
  170. struct batch_status *next;
  171. char *name;
  172. struct attrl *attribs;
  173. char *text;
  174. }
  175. .fi
  176. .LP
  177. The entry,
  178. .I attribs ,
  179. is a pointer to a list of attrl structures defined in
  180. pbs_ifl.h as:
  181. .sp
  182. .Ty
  183. .nf
  184. struct attrl {
  185. struct attrl *next;
  186. char *name;
  187. char *resource;
  188. char *value;
  189. };
  190. .fi
  191. .LP
  192. It is up the user to free the list of batch_status structures when no longer
  193. needed, by calling \f3pbs_statfree\f1().
  194. .LP
  195. The extend parameter is for optional features and or additions. Normally, this should be null pointer.
  196. .LP
  197. .B Finished and Moved Jobs
  198. .br
  199. In order to get information on finished and moved jobs, you must add an
  200. .I 'x'
  201. character to the
  202. .I extend
  203. parameter. The
  204. .I extend
  205. parameter is a character string; set one character
  206. to be the
  207. .I 'x'
  208. character.
  209. For example:
  210. .RS 5
  211. .br
  212. .B pbs_selstat
  213. ( ..., ..., ..., extend) ...
  214. .RE
  215. .LP
  216. To get information on finished and moved jobs only, specify the Finished ('F')
  217. and moved ('M') job states. You must also use the
  218. .I extend
  219. character string containing the
  220. .I 'x'
  221. character. For example:
  222. .RS 5
  223. .br
  224. sel_list->next = sel_list;
  225. .br
  226. sel_list->name = ATTR_state;
  227. .br
  228. sel_list->value = "MF";
  229. .br
  230. sel_list->op = EQ;
  231. .br
  232. .B pbs_selstat
  233. ( ..., sel_list, ..., extend) ...
  234. .RE
  235. .LP
  236. Subjobs are not considered finished until the parent array job is finished.
  237. .LP
  238. .SH "SEE ALSO"
  239. qselect(1B), pbs_alterjob(3B), pbs_connect(3B), pbs_statjob(3B), and
  240. pbs_selectjob(3B).
  241. .SH DIAGNOSTICS
  242. When the batch request generated by pbs_selstat()
  243. function has been completed successfully by a batch server, the routine will
  244. return a pointer to the list of batch_status structures.
  245. If no jobs met the criteria or an error occurred, the return will be the
  246. null pointer. If an error occurred, the global integer pbs_errno will
  247. be set to a non-zero value.