-
Notifications
You must be signed in to change notification settings - Fork 0
/
App_Python.tex
3343 lines (2350 loc) · 87.2 KB
/
App_Python.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Appendix: Python bindings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Python Bindings}
\label{app:python}
While the \ac{PMIx} Standard is defined in terms of C-based \acp{API}, there is no intent to limit the use of \ac{PMIx} to that specific language. Support for other languages is captured in the Standard by describing their equivalent syntax for the \ac{PMIx} \acp{API} and native forms for the \ac{PMIx} datatypes. This Appendix specifically deals with Python interfaces, beginning with a review of the \ac{PMIx} datatypes. Support is restricted to Python 3 and above - i.e., the Python bindings do not support Python 2.
Note: the \ac{PMIx} \acp{API} have been loosely collected into three Python classes based on their \ac{PMIx} “class” (i.e., client, server, and tool). All processes have access to a basic set of the \acp{API}, and therefore those have been included in the “client” class. Servers can utilize any of those functions plus a set focused on operations not commonly executed by an application process. Finally, tools can also act as servers but have their own initialization function.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Design Considerations}
\label{app:python:design}
Several issues arose during design of the Python bindings:
\subsection{Error Codes vs Python Exceptions}
\label{app:python:exceptions}
The C programming language reports errors through the return of the corresponding integer status codes. \ac{PMIx} has defined a range of negative values for this purpose. However, Python has the option of raising \emph{exceptions} that effectively operate as interrupts that can be trapped if the program appropriately tests for them. The \ac{PMIx} Python bindings opted to follow the C-based standard and return \ac{PMIx} status codes in lieu of raising exceptions as this method was considered more consistent for those working in both domains.
\subsection{Representation of Structured Data}
\label{app:python:rep}
\ac{PMIx} utilizes a number of C-language structures to efficiently bundle related information. For example, the \ac{PMIx} process identifier is represented as a struct containing a character array for the namespace and a 32-bit unsigned integer for the process rank. There are several options for translating such objects to Python – e.g., the \ac{PMIx} process identifier could be represented as a two-element tuple (nspace, rank) or as a dictionary {‘nspace’: name, ‘rank’: 0}. Exploration found no discernible benefit to either representation, nor was any clearly identifiable rationale developed that would lead a user to expect one versus the other for a given \ac{PMIx} data type. Consistency in the translation (i.e., exclusively using tuple or dictionary) appeared to be the most important criterion. Hence, the decision was made to express all complex datatypes as Python dictionaries.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Datatype Definitions}
\label{app:python:types}
\ac{PMIx} defines a number of datatypes comprised of fixed-size character arrays, restricted range integers (e.g., uint32_t), and structures. Each datatype is represented by a named unsigned 16-bit integer (\code{uint16_t}) constant. Users are advised to use the named \ac{PMIx} constants for indicating datatypes instead of integer values to ensure compatibility with future PMIx versions.
With only a few exceptions, the C-based \ac{PMIx} datatypes defined in \chapterref{chap:struct} directly translate to Python. However, Python lacks the size-specific value definitions of C (e.g., \code{uint8_t}) and thus some care must be taken to protect against overflow/underflow situations when moving between the languages. Python bindings that accept values including \ac{PMIx} datatypes shall therefore have the datatype and associated value checked for compatibility with their \ac{PMIx}-defined equivalents, returning an error if:
\begin{itemize}
\item datatypes not defined by \ac{PMIx} are encountered
\item provided values fall outside the range of the C-equivalent definition - e.g., if a value identified as \refconst{PMIX_UINT8} lies outside the \code{uint8_t}range
\end{itemize}
Note that explicit labeling of \ac{PMIx} datatype, even when Python itself doesn’t care, is often required for the Python bindings to know how to properly interpret and label the provided value when passing it to the \ac{PMIx} library.
Table~\ref{app:python:ctopy} lists the correspondence between datatypes in the two languages.
\begin{landscape}
\begin{small}
\begin{longtable}{ | p{4.5cm} | p{4cm} | p{3cm} | p{5.5cm} |}
\caption{C-to-Python Datatype Correspondence} \label{app:python:ctopy} \\
\hline
C-Definition & PMIx Name & Python Definition & Notes \\ \hline
\endhead
\code{bool} & PMIX_BOOL & boolean & \\ \hline
\code{byte} & PMIX_BYTE & A single element byte array (i.e., a byte array of length one) & \\ \hline
\code{char*} & PMIX_STRING & string & \\ \hline
\code{size_t} & PMIX_SIZE & integer & \\ \hline
\code{pid_t} & PMIX_PID & integer & value shall be limited to the \code{uint32_t} range \\ \hline
\code{int, int8_t, int16_t, int32_t, int64_t} & PMIX_INT, PMIX_INT8, PMIX_INT16, PMIX_INT32, PMIX_INT64 & integer & value shall be limited to its corresponding range \\ \hline
\code{uint, uint8_t, uint16_t, uint32_t, uint64_t} & PMIX_UINT, PMIX_UINT8, PMIX_UINT16, PMIX_UINT32, PMIX_UINT64 & integer & value shall be limited to its corresponding range \\ \hline
\code{float, double} & PMIX_FLOAT, PMIX_DOUBLE & float & value shall be limited to its corresponding range \\ \hline
\code{struct timeval} & PMIX_TIMEVAL & \{'sec': sec, 'usec': microsec\} & each field is an integer value \\ \hline
\code{time_t} & PMIX_TIME & integer & limited to positive values \\ \hline
\refstruct{pmix_data_type_t} & PMIX_DATA_TYPE & integer & value shall be limited to the \code{uint16_t} range \\ \hline
\refstruct{pmix_status_t} & PMIX_STATUS & integer & \\ \hline
\refstruct{pmix_key_t} & N/A & \pylabel{key}string & The string's length shall be limited to one less than the size of the \refstruct{pmix_key_t} array (to reserve space for the terminating \code{NULL}) \\ \hline
\refstruct{pmix_nspace_t} & N/A & \pylabel{nspace}string & The string's length shall be limited to one less than the size of the \refstruct{pmix_nspace_t} array (to reserve space for the terminating \code{NULL}) \\ \hline
\refstruct{pmix_rank_t} & PMIX_PROC_RANK & \pylabel{rank}integer & value shall be limited to the \code{uint32_t} range excepting the reserved values near \code{UINT32_MAX} \\ \hline
\refstruct{pmix_proc_t} & PMIX_PROC & \pylabel{proc}\{'nspace': nspace, 'rank': rank\} & \refarg{nspace} is a Python string and \refarg{rank} is an integer value. The \refarg{nspace} string's length shall be limited to one less than the size of the \refstruct{pmix_nspace_t} array (to reserve space for the terminating \code{NULL}), and the \refarg{rank} value shall conform to the constraints associated with \refstruct{pmix_rank_t} \\ \hline
\refstruct{pmix_byte_object_t} & PMIX_BYTE_OBJECT & \pylabel{byteobject}\{'bytes': bytes, 'size': size\} & \refarg{bytes} is a Python byte array and \refarg{size} is the integer number of bytes in that array. \\ \hline
\refstruct{pmix_persistence_t} & PMIX_PERSISTENCE & integer & value shall be limited to the \code{uint8_t} range \\ \hline
\refstruct{pmix_scope_t} & PMIX_SCOPE & integer & value shall be limited to the \code{uint8_t} range \\ \hline
\refstruct{pmix_data_range_t} & PMIX_RANGE & \pylabel{range}integer & value shall be limited to the \code{uint8_t} range \\ \hline
\refstruct{pmix_proc_state_t} & PMIX_PROC_STATE & integer & value shall be limited to the \code{uint8_t} range \\ \hline
\refstruct{pmix_proc_info_t} & PMIX_PROC_INFO & \{'proc': \{'nspace': nspace, 'rank': rank\}, 'hostname': hostname, 'executable': executable, 'pid': pid, 'exitcode': exitcode, 'state': state\} & \refarg{proc} is a Python \refpy{proc} dictionary; \refarg{hostname} and \refarg{executable} are Python strings; and \refarg{pid}, \refarg{exitcode}, and \refarg{state} are Python integers \\ \hline
\refstruct{pmix_data_array_t} & PMIX_DATA_ARRAY & \pylabel{array}\{'type': type, 'array': array\} & \refarg{type} is the \ac{PMIx} type of object in the array and \refarg{array} is a Python \emph{list} containing the individual array elements. Note that \refarg{array} can consist of \emph{any} \ac{PMIx} types, including (for example) a Python \refpy{info} object that itself contains an \refpy{array} value \\ \hline
\refstruct{pmix_info_directives_t} & PMIX_INFO_DIRECTIVES & \pylabel{info directives}integer & value shall be limited to the \code{uint32_t} range \\ \hline
\refstruct{pmix_alloc_directive_t} & PMIX_ALLOC_DIRECTIVE & \pylabel{allocdir}integer & value shall be limited to the \code{uint8_t} range \\ \hline
\refstruct{pmix_iof_channel_t} & PMIX_IOF_CHANNEL & \pylabel{channel}integer & value shall be limited to the \code{uint16_t} range \\ \hline
\refstruct{pmix_envar_t} & PMIX_ENVAR & \{'envar': envar, 'value': value, 'separator': separator\} & \refarg{envar} and \refarg{value} are Python strings, and \refarg{separator} a single-character Python string \\ \hline
\refstruct{pmix_value_t} & PMIX_VALUE & \pylabel{value}\{'value': value, 'val_type': type\} & \refarg{type} is the \ac{PMIx} datatype of \refarg{value}, and \refarg{value} is the associated value expressed in the appropriate Python form for the specified datatype \\ \hline
\refstruct{pmix_info_t} & PMIX_INFO & \pylabel{info}\{'key': key, 'flags': flags, value': value, 'val_type': type\} & \refarg{key} is a Python string \refpy{key}, \refarg{flags} is a bitmask of \refpy{info directives}, \refarg{type} is the \ac{PMIx} datatype of \refarg{value}, and \refarg{value} is the associated value expressed in the appropriate Python form for the specified datatype \\ \hline
\refstruct{pmix_pdata_t} & PMIX_PDATA & \pylabel{pdata}\{'proc': \{'nspace': nspace, 'rank': rank\}, 'key': key, 'value': value, 'val_type': type\} & \refarg{proc} is a Python \refpy{proc} dictionary; \refarg{key} is a Python string \refpy{key}; \refarg{type} is the \ac{PMIx} datatype of \refarg{value}; and \refarg{value} is the associated value expressed in the appropriate Python form for the specified datatype \\ \hline
\refstruct{pmix_app_t} & PMIX_APP & \pylabel{app}\{'cmd': cmd, 'argv': [argv], 'env': [env], 'maxprocs': maxprocs, 'info': [info]\} & \refarg{cmd} is a Python string; \refarg{argv} and \refarg{env} are Python \emph{lists} containing Python strings; \refarg{maxprocs} is an integer; and \refarg{info} is a Python \emph{list} of \refpy{info} values \\ \hline
\refstruct{pmix_query_t} & PMIX_QUERY & \pylabel{query}\{'keys': [keys], 'qualifiers': [info]\} & \refarg{keys} is a Python \emph{list} of Python strings, and \refarg{qualifiers} is a Python \emph{list} of \refpy{info} values \\ \hline
\refstruct{pmix_regattr_t} & PMIX_REGATTR & \pylabel{regattr}\{'name': name, 'key': key, 'type': type, info': [info], 'description': [desc]\} & \refarg{name} and \refarg{string} are Python strings; \refarg{type} is the \ac{PMIx} datatype for the attribute's value; \refarg{info} is a Python \emph{list} of \refpy{info} values; and \refarg{description} is a list of Python strings describing the attribute \\ \hline
\hline
\end{longtable}
\end{small}
\end{landscape}
\subsection{Example}
Converting a C-based program to its Python equivalent requires translation of the relevant datatypes as well as use of the appropriate \ac{API} form. An example small program may help illustrate the changes. Consider the following C-based program snippet:
\begin{codepar}
#include <pmix.h>
...
pmix_info_t info[2];
PMIX_INFO_LOAD(&info[0], PMIX_PROGRAMMING_MODEL, "TEST", PMIX_STRING)
PMIX_INFO_LOAD(&info[1], PMIX_MODEL_LIBRARY_NAME, "PMIX", PMIX_STRING)
rc = PMIx_Init(&myproc, info, 2);
PMIX_INFO_DESTRUCT(&info[0]); // free the copied string
PMIX_INFO_DESTRUCT(&info[1]); // free the copied string
\end{codepar}
Moving to the Python version requires that the \refstruct{pmix_info_t} be translated to the Python \refpy{info} equivalent, and that the returned information be captured in the return parameters as opposed to a pointer parameter in the function call, as shown below:
\begin{codepar}
import pmix
...
myclient = PMIxClient()
info = [\{'key':PMIX_PROGRAMMING_MODEL,
'value':'TEST', 'val_type':PMIX_STRING\},
\{'key':PMIX_MODEL_LIBRARY_NAME,
'value':'PMIX', 'val_type':PMIX_STRING\}]
rc,myproc = myclient.init(info)
\end{codepar}
Note the use of the \refconst{PMIX_STRING} identifier to ensure the Python bindings interpret the provided string value as a \ac{PMIx} "string" and not an array of bytes.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Function Definitions}
\label{app:python:fns}
%%%%%%%%%%%
\subsection{IOF Delivery Function}
\pylabel{iofcbfunc}
%%%%
\summary
Callback function for delivering forwarded \ac{IO} to a process
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def iofcbfunc(iofhdlr:integer, channel:integer,
source:dict, payload:dict, info:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{iofhdlr}{Registration number of the handler being invoked (integer)}
\argin{channel}{Python \refpy{channel} bitmask identifying the channel the data arrived on (integer)}
\argin{source}{Python \refpy{proc} identifying the namespace/rank of the process that generated the data (dict)}
\argin{payload}{Python \refpy{byteobject} containing the data (dict)}
\argin{info}{List of Python \refpy{info} provided by the source containing metadata about the payload. This could include \refattr{PMIX_IOF_COMPLETE} (list)}
\end{arglist}
Returns: nothing
See \refapi{pmix_iof_cbfunc_t} for details
%%%%%%%%%%%
\subsection{Event Handler}
\pylabel{evhandler}
%%%%
\summary
Callback function for event handlers
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def evhandler(evhdlr:integer, status:integer,
source:dict, info:list, results:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{iofhdlr}{Registration number of the handler being invoked (integer)}
\argin{status}{Status associated with the operation (integer)}
\argin{source}{Python \refpy{proc} identifying the namespace/rank of the process that generated the event (dict)}
\argin{info}{List of Python \refpy{info} provided by the source containing metadata about the event (list)}
\argin{results}{List of Python \refpy{info} containing the aggregated results of all prior evhandlers (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - Status returned by the event handler's operation (integer)
\item \refarg{results} - List of Python \refpy{info} containing results from this event handler's operation on the event (list)
\end{itemize}
See \refapi{pmix_notification_fn_t} for details
%%%%%%%%%%%
\subsection{Server Module Functions}
\pylabel{server module}
The following definitions represent functions that may be provided to the \ac{PMIx} server library at time of initialization for servicing of client requests. Module functions that are not provided default to returning "not supported" to the caller.
%%%%%%%%%%%
\subsubsection{Client Connected}
%%%%
\summary
Notify the host server that a client connected to this server.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def clientconnected(proc:dict is not None)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} identifying the namespace/rank of the process that connected (dict)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the connection should be rejected (integer)
\end{itemize}
See \refapi{pmix_server_client_connected_fn_t} for details
%%%%%%%%%%%
\subsubsection{Client Finalized}
%%%%
\summary
Notify the host environment that a client called \refapi{PMIx_Finalize}.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def clientfinalized(proc:dict is not None):
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} identifying the namespace/rank of the process that finalized (dict)}
\end{arglist}
Returns: nothing
See \refapi{pmix_server_client_finalized_fn_t} for details
%%%%%%%%%%%
\subsubsection{Client Aborted}
%%%%
\summary
Notify the host environment that a local client called \refapi{PMIx_Abort}.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def clientaborted(proc:dict is not None, status:integer,
msg:str, targets:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} identifying the namespace/rank of the process that called abort (dict)}
\argin{status}{PMIx status to be returned on exit (integer)}
\argin{msg}{String message to be printed (string)}
\argin{targets}{List of Python \refpy{proc} dictionaries (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_abort_fn_t} for details
%%%%%%%%%%%
\subsubsection{Fence}
%%%%
\summary
At least one client called either \refapi{PMIx_Fence} or \refapi{PMIx_Fence_nb}
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def fence(procs:list, directives:list, data:bytearray)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{procs}{List of Python \refpy{proc} dictionaries (list)}
\argin{directives}{List of Python \refpy{info} dictionaries (list)}
\argin{data}{Python bytearray of data to be circulated during fence operation (bytearray)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item \refarg{data} - Python bytearray containing the aggregated data from all participants (bytearray)
\end{itemize}
See \refapi{pmix_server_fencenb_fn_t} for details
%%%%%%%%%%%
\subsubsection{Direct Modex}
%%%%
\summary
Used by the PMIx server to request its local host contact the \ac{PMIx} server on the remote node that hosts the specified proc to obtain and return a direct modex blob for that proc.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def dmodex(proc:dict, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} dictionary of process whose data is being requested (list)}
\argin{directives}{List of Python \refpy{info} dictionaries (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item \refarg{data} - Python bytearray containing the data for the specified process (bytearray)
\end{itemize}
See \refapi{pmix_server_dmodex_req_fn_t} for details
%%%%%%%%%%%
\subsubsection{Publish}
%%%%
\summary
Publish data per the PMIx API specification.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def publish(proc:dict, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} dictionary of process publishing the data (list)}
\argin{directives}{List of Python \refpy{info} dictionaries containing data and directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_publish_fn_t} for details
%%%%%%%%%%%
\subsubsection{Lookup}
%%%%
\summary
Lookup published data.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def lookup(proc:dict, keys:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} dictionary of process seeking the data (list)}
\argin{keys}{List of Python strings (list)}
\argin{directives}{List of Python \refpy{info} dictionaries containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item \refarg{pdata} - List of \refpy{pdata} containing the returned results (list)
\end{itemize}
See \refapi{pmix_server_lookup_fn_t} for details
%%%%%%%%%%%
\subsubsection{Unpublish}
%%%%
\summary
Delete data from the data store.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def unpublish(proc:dict, keys:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} dictionary of process making the request (list)}
\argin{keys}{List of Python strings (list)}
\argin{directives}{List of Python \refpy{info} dictionaries containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_unpublish_fn_t} for details
%%%%%%%%%%%
\subsubsection{Spawn}
%%%%
\summary
Spawn a set of applications/processes as per the \refapi{PMIx_Spawn} API.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def spawn(proc:dict, jobInfo:list, apps:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} dictionary of process making the request (list)}
\argin{jobInfo}{List of Python \refpy{info} job-level directives and information (list)}
\argin{apps}{List of Python \refpy{app} dictionaries describing applications to be spawned (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item \refarg{nspace} - Python string containing namespace of the spawned job (str)
\end{itemize}
See \refapi{pmix_server_spawn_fn_t} for details
%%%%%%%%%%%
\subsubsection{Connect}
%%%%
\summary
Record the specified processes as \textit{connected}.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def connect(procs:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{procs}{List of Python \refpy{proc} dictionaries identifying participants (list)}
\argin{directives}{List of Python \refpy{info} directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_connect_fn_t} for details
%%%%%%%%%%%
\subsubsection{Disconnect}
%%%%
\summary
Disconnect a previously connected set of processes.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def disconnect(procs:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{procs}{List of Python \refpy{proc} dictionaries identifying participants (list)}
\argin{directives}{List of Python \refpy{info} directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_disconnect_fn_t} for details
%%%%%%%%%%%
\subsubsection{Register Events}
%%%%
\summary
Register to receive notifications for the specified events.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def register_events(codes:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{codes}{List of Python integers (list)}
\argin{directives}{List of Python \refpy{info} directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_register_events_fn_t} for details
%%%%%%%%%%%
\subsubsection{Deregister Events}
%%%%
\summary
Deregister to receive notifications for the specified events.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def deregister_events(codes:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{codes}{List of Python integers (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_deregister_events_fn_t} for details
%%%%%%%%%%%
\subsubsection{Notify Event}
%%%%
\summary
Notify the specified range of processes of an event.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def notify_event(code:integer, source:dict, range:integer, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{code}{Python integer \refstruct{pmix_status_t} (list)}
\argin{source}{Python \refpy{proc} of process that generated the event (dict)}
\argin{range}{Python \refpy{range} in which the event is to be reported (integer)}
\argin{directives}{List of Python \refpy{info} directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_notify_event_fn_t} for details
%%%%%%%%%%%
\subsubsection{Query}
%%%%
\summary
Query information from the resource manager.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def query(proc:dict, queries:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} of requesting process (dict)}
\argin{queries}{List of Python \refpy{query} directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item \refarg{info} - List of Python \refpy{info} containing the returned results (list)
\end{itemize}
See \refapi{pmix_server_query_fn_t} for details
%%%%%%%%%%%
\subsubsection{Tool Connected}
%%%%
\summary
Register that a tool has connected to the server.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def tool_connected(info:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{info}{List of Python \refpy{info} containing info on the connecting tool (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item \refarg{proc} - Python \refpy{proc} containing the assigned namespace:rank for the tool (dict)
\end{itemize}
See \refapi{pmix_server_tool_connection_fn_t} for details
%%%%%%%%%%%
\subsubsection{Log}
%%%%
\summary
Log data on behalf of a client.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def log(proc:dict, data:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} of requesting process (dict)}
\argin{data}{List of Python \refpy{info} containing data to be logged (list)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_log_fn_t} for details
%%%%%%%%%%%
\subsubsection{Allocate Resources}
%%%%
\summary
Request allocation operations on behalf of a client.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def allocate(proc:dict, action:integer, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} of requesting process (dict)}
\argin{action}{Python \refpy{allocdir} specifying requested action (integer)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item refarg{info} - List of Python \refpy{info} containing results of requested operation (list)
\end{itemize}
See \refapi{pmix_server_alloc_fn_t} for details
%%%%%%%%%%%
\subsubsection{Job Control}
%%%%
\summary
Execute a job control action on behalf of a client.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def job_control(proc:dict, targets:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} of requesting process (dict)}
\argin{targets}{List of Python \refpy{proc} specifying target processes (list)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_job_control_fn_t} for details
%%%%%%%%%%%
\subsubsection{Monitor}
%%%%
\summary
Request that a client be monitored for activity.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def monitor(proc:dict, request:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} of requesting process (dict)}
\argin{request}{List of Python \refpy{info} specifying requested monitoring operations (list)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_monitor_fn_t} for details
%%%%%%%%%%%
\subsubsection{Get Credential}
%%%%
\summary
Request a credential from the host environment
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def get_credential(proc:dict, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} of requesting process (dict)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item \refarg{cred} - Python \refpy{byteobject} containing returned credential (dict)
\item \refarg{info} - List of Python \refpy{info} containing any additional info about the credential (list)
\end{itemize}
See \refapi{pmix_server_get_cred_fn_t} for details
%%%%%%%%%%%
\subsubsection{Validate Credential}
%%%%
\summary
Request validation of a credential
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def validate_credential(proc:dict, cred:dict, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{proc}{Python \refpy{proc} of requesting process (dict)}
\argin{cred}{Python \refpy{byteobject} containing credential (dict)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item \refarg{info} - List of Python \refpy{info} containing any additional info from the credential (list)
\end{itemize}
See \refapi{pmix_server_validate_cred_fn_t} for details
%%%%%%%%%%%
\subsubsection{IO Forward}
%%%%
\summary
Request the specified IO channels be forwarded from the given array of processes.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def iof_pull(sources:list, channels:integer, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{sources}{List of Python \refpy{proc} whose IO is being requested (list)}
\argin{channels}{Bitmask of Python \refpy{channel} identifying IO channels to be forwarded (integer)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_iof_fn_t} for details
%%%%%%%%%%%
\subsubsection{IO Push}
%%%%
\summary
Pass standard input data to the host environment for transmission to specified recipients.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def iof_push(source:dict, targets:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{source}{Python \refpy{proc} whose stdin data is being provided (dict)}
\argin{targets}{List of Python \refpy{proc} identifying targets to receive the provided data (list)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\end{itemize}
See \refapi{pmix_server_stdin_fn_t} for details
%%%%%%%%%%%
\subsubsection{Group Operations}
%%%%
\summary
Request group operations (construct, destruct, etc.) on behalf of a set of processes.
%%%%
\format
\versionMarker{4.0}
\pyspecificstart
\begin{codepar}
def group(op:integer, grp:str, procs:list, directives:list)
\end{codepar}
\pyspecificend
\begin{arglist}
\argin{op}{Operation host is to perform on the specified group (integer)}
\argin{grp}{String identifier of target group (str)}
\argin{procs}{List of Python \refpy{proc} of participating processes (dict)}
\argin{directives}{List of Python \refpy{info} containing directives (list)}
\end{arglist}
Returns:
\begin{itemize}
\item \refarg{rc} - \refconst{PMIX_SUCCESS} or a \ac{PMIx} error code indicating the operation failed (integer)
\item refarg{info} - List of Python \refpy{info} containing results of requested operation (list)
\end{itemize}
See \refapi{pmix_server_grp_fn_t} for details