Skip to content

Commit f1ae036

Browse files
Merge pull request #6771 from ggouaillardet/topic/pmix_refresh
pmix/pmix4x: refresh to the latest PMIx master
2 parents 6433da7 + 5679a88 commit f1ae036

File tree

10 files changed

+295
-96
lines changed

10 files changed

+295
-96
lines changed

opal/mca/pmix/pmix4x/pmix/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ greek=a1
3030
# command, or with the date (if "git describe" fails) in the form of
3131
# "date<date>".
3232

33-
repo_rev=git186dca19
33+
repo_rev=gitf67efc83
3434

3535
# If tarball_version is not empty, it is used as the version string in
3636
# the tarball filename, regardless of all other versions listed in
@@ -44,7 +44,7 @@ tarball_version=
4444

4545
# The date when this release was created
4646

47-
date="Jun 10, 2019"
47+
date="Jun 24, 2019"
4848

4949
# The shared library version of each of PMIx's public libraries.
5050
# These versions are maintained in accordance with the "Library
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
@PMIX_PYTHON_PATH@
2+
3+
from pmix import *
4+
import signal, time
5+
import os
6+
import select
7+
import subprocess
8+
9+
global killer
10+
11+
class GracefulKiller:
12+
kill_now = False
13+
def __init__(self):
14+
signal.signal(signal.SIGINT, self.exit_gracefully)
15+
signal.signal(signal.SIGTERM, self.exit_gracefully)
16+
17+
def exit_gracefully(self,signum, frame):
18+
self.kill_now = True
19+
20+
def clientconnected(proc:tuple is not None):
21+
print("CLIENT CONNECTED", proc)
22+
return PMIX_SUCCESS
23+
24+
def clientfinalized(proc:tuple is not None):
25+
print("CLIENT FINALIZED", proc)
26+
return PMIX_SUCCESS
27+
28+
def clientfence(args:dict is not None):
29+
print("SERVER FENCE", args)
30+
return PMIX_SUCCESS
31+
32+
def main():
33+
try:
34+
foo = PMIxServer()
35+
except:
36+
print("FAILED TO CREATE SERVER")
37+
exit(1)
38+
print("Testing server version ", foo.get_version())
39+
args = {PMIX_SERVER_SCHEDULER: ('T', PMIX_BOOL)}
40+
map = {'clientconnected': clientconnected,
41+
'clientfinalized': clientfinalized,
42+
'fencenb': clientfence}
43+
my_result = foo.init(args, map)
44+
print("Testing PMIx_Initialized")
45+
rc = foo.initialized()
46+
print("Initialized: ", rc)
47+
vers = foo.get_version()
48+
print("Version: ", vers)
49+
50+
# Register a fabric
51+
rc = foo.register_fabric(None)
52+
print("Fabric registered: ", rc)
53+
54+
# Get the number of vertices in this fabric
55+
nverts = foo.get_num_vertices()
56+
print("Nverts in fabric: ", nverts)
57+
58+
# setup the application
59+
(rc, regex) = foo.generate_regex("test000,test001,test002")
60+
print("Node regex: ", regex)
61+
(rc, ppn) = foo.generate_ppn("0,1,2;3,4,5;6,7")
62+
print("PPN: ", ppn)
63+
darray = (PMIX_INFO, [{PMIX_ALLOC_NETWORK_ID: ("SIMPSCHED.net", PMIX_STRING)},
64+
{PMIX_ALLOC_NETWORK_SEC_KEY: ('T', PMIX_BOOL)},
65+
{PMIX_SETUP_APP_ENVARS: ('T', PMIX_BOOL)}])
66+
kyvals = {PMIX_NODE_MAP: (regex, PMIX_STRING), PMIX_PROC_MAP: (ppn, PMIX_STRING), PMIX_ALLOC_NETWORK: (darray, PMIX_DATA_ARRAY)}
67+
68+
appinfo = []
69+
rc, appinfo = foo.setup_application("SIMPSCHED", kyvals)
70+
print("SETUPAPP: ", appinfo)
71+
72+
rc = foo.setup_local_support("SIMPSCHED", appinfo)
73+
print("SETUPLOCAL: ", rc)
74+
75+
# get our environment as a base
76+
env = os.environ.copy()
77+
78+
# register an nspace for the client app
79+
kvals = {PMIX_NODE_MAP: (regex, PMIX_STRING), PMIX_PROC_MAP: (ppn, PMIX_STRING), PMIX_UNIV_SIZE: (1, PMIX_UINT32), PMIX_JOB_SIZE: (1, PMIX_UINT32)}
80+
print("REGISTERING NSPACE")
81+
rc = foo.register_nspace("testnspace", 1, kvals)
82+
print("RegNspace ", rc)
83+
84+
# register a client
85+
uid = os.getuid()
86+
gid = os.getgid()
87+
print("REGISTERING CLIENT")
88+
rc = foo.register_client(("testnspace", 0), uid, gid)
89+
print("RegClient ", rc)
90+
91+
# setup the fork
92+
rc = foo.setup_fork(("testnspace", 0), env)
93+
print("SetupFrk", rc)
94+
95+
# setup the client argv
96+
args = ["./client.py"]
97+
# open a subprocess with stdout and stderr
98+
# as distinct pipes so we can capture their
99+
# output as the process runs
100+
p = subprocess.Popen(args, env=env,
101+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
102+
# define storage to catch the output
103+
stdout = []
104+
stderr = []
105+
# loop until the pipes close
106+
while True:
107+
reads = [p.stdout.fileno(), p.stderr.fileno()]
108+
ret = select.select(reads, [], [])
109+
110+
stdout_done = True
111+
stderr_done = True
112+
113+
for fd in ret[0]:
114+
# if the data
115+
if fd == p.stdout.fileno():
116+
read = p.stdout.readline()
117+
if read:
118+
read = read.decode('utf-8').rstrip()
119+
print('stdout: ' + read)
120+
stdout_done = False
121+
elif fd == p.stderr.fileno():
122+
read = p.stderr.readline()
123+
if read:
124+
read = read.decode('utf-8').rstrip()
125+
print('stderr: ' + read)
126+
stderr_done = False
127+
128+
if stdout_done and stderr_done:
129+
break
130+
131+
print("FINALIZING")
132+
foo.finalize()
133+
134+
if __name__ == '__main__':
135+
global killer
136+
killer = GracefulKiller()
137+
main()

opal/mca/pmix/pmix4x/pmix/config/pmix.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[
913913
if test "$WANT_PYTHON_BINDINGS" = "1"; then
914914
AC_CONFIG_FILES(pmix_config_prefix[bindings/python/server.py], [chmod +x bindings/python/server.py])
915915
AC_CONFIG_FILES(pmix_config_prefix[bindings/python/client.py], [chmod +x bindings/python/client.py])
916+
AC_CONFIG_FILES(pmix_config_prefix[bindings/python/sched.py], [chmod +x bindings/python/sched.py])
916917
fi
917918

918919
# publish any embedded flags so external wrappers can use them

0 commit comments

Comments
 (0)