18.2.273. PMIx_tool_get_servers
PMIx_tool_get_servers — Return the process identifiers of all servers
to which a tool is currently connected.
18.2.273.1. SYNOPSIS
#include <pmix_tool.h>
pmix_status_t PMIx_tool_get_servers(pmix_proc_t *servers[],
size_t *nservers);
18.2.273.1.1. Python Syntax
from pmix import *
foo = PMIxTool()
rc, myname = foo.init(None)
# ... attach to one or more servers ...
rc, servers = foo.get_servers()
# servers is a list of {'nspace':..., 'rank':...} dictionaries
18.2.273.2. OUTPUT PARAMETERS
servers: Address at which the pointer to a newly allocated array of pmix_proc_t(5) structures is returned, one entry per connected server. The tool’s current primary (active) server, if any, is placed at the front of the array.nservers: Address at which the number of elements in the returnedserversarray is stored.
18.2.273.3. DESCRIPTION
Obtain the set of PMIx servers to which the tool currently holds a connection. On success the routine allocates an array of pmix_proc_t(5) structures and returns its address and element count through the two output parameters. If the tool has an active primary server, that server’s identifier is returned as the first element of the array.
This is a blocking call: internally the request is thread-shifted onto the progress thread, which walks the tool’s list of server connections and builds the returned array.
18.2.273.4. RETURN VALUE
Returns PMIX_SUCCESS and a non-empty array when the tool is connected to at
least one server. On error, a negative value corresponding to a PMIx error
constant is returned, including:
PMIX_ERR_INIT— the tool library has not been initialized.PMIX_ERR_NOT_AVAILABLE— the internal progress thread has been stopped, so the operation cannot be serviced.PMIX_ERR_UNREACH— the tool is not currently connected to any server; in this case no array is returned andnserversis set to zero.
Other negative values indicate an appropriate error condition. PMIx error
constants are defined in pmix_common.h.
18.2.273.5. NOTES
The caller assumes ownership of the returned servers array and is responsible
for releasing it. In C, the array is allocated with the PMIx allocation macros
and should be freed with PMIX_PROC_FREE(servers, nservers); the Python
binding returns an ordinary list and frees the underlying array automatically.