Skip to content

Commit

Permalink
Adding documentation about remote mapdl pool (#3046)
Browse files Browse the repository at this point in the history
* Adding documentation about remote mapdl pool

* Rephrase

* Apply suggestions from code review

Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>

---------

Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
  • Loading branch information
germa89 and PipKat committed May 3, 2024
1 parent c49524c commit 32d676b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions doc/source/user_guide/pool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ at the current directory within their own isolated directories:
>>> pool = MapdlPool(10, nproc=1, run_location=my_path)
Creating Pool: 100%|########| 10/10 [00:01<00:00, 1.43it/s]
Additionally, you can group already running MAPDL instances into an
:class:`MapdlPool <ansys.mapdl.core.pool.MapdlPool>` instance by specifying
their ports when creating the pool.

.. code:: pycon
>>> from ansys.mapdl.core import MapdlPool
>>> pool = MapdlPool(port=[50082, 50083, 50084, 50085, 50086])
'MAPDL Pool with 5 active instances'
>>> pool.exit(block=True)
You can access each individual MAPDL instance with this code:

.. code:: pycon
Expand Down
4 changes: 3 additions & 1 deletion src/ansys/mapdl/core/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class MapdlPool:

def __init__(
self,
n_instances: int,
n_instances: int = None,
wait: bool = True,
run_location: Optional[str] = None,
port: Union[int, List[int]] = MAPDL_DEFAULT_PORT,
Expand Down Expand Up @@ -241,6 +241,7 @@ def __init__(
ports = available_ports(n_instances, port)
else:
ports = port
n_instances = len(ports)

if self._root_dir is not None:
if not os.path.isdir(self._root_dir):
Expand All @@ -250,6 +251,7 @@ def __init__(
ports = [port + i for i in range(n_instances)]
else:
ports = port
n_instances = len(ports)

if len(ports) != n_instances:
raise ValueError(
Expand Down

0 comments on commit 32d676b

Please sign in to comment.