-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add launch configuration howto #389
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,91 @@ | ||
Changing how ACP is started | ||
--------------------------- | ||
|
||
TODO | ||
By default, the :func:`.launch_acp` function will start ACP from the unified installer, using the latest available version. | ||
|
||
Change the default launch configuration | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
To change this behavior, you can use the ``ansys-launcher`` command line tool to configure how ACP is started. | ||
|
||
.. note:: | ||
|
||
On Windows, the executable may be called ``ansys-launcher.exe``. | ||
|
||
.. code-block:: bash | ||
|
||
$ ansys-launcher configure ACP | ||
Usage: ansys-launcher configure ACP [OPTIONS] COMMAND [ARGS]... | ||
|
||
Options: | ||
--help Show this message and exit. | ||
|
||
Commands: | ||
direct | ||
docker_compose | ||
|
||
In the preceding output, the two available methods for starting ACP are listed: | ||
- ``direct``: start ACP directly by providing the path to the ``acp_grpcserver`` executable. | ||
- ``docker_compose``: start ACP using Docker Compose. | ||
|
||
Either method can be configured with ``ansys-launcher``. For example, to use the | ||
``direct`` method, you can run ``ansys-launcher configure ACP direct``. | ||
The tool will prompt you for the required information, providing a default value | ||
in square brackets. You can press Enter to accept the default value, or type a | ||
new value and press Enter. | ||
|
||
.. code-block:: bash | ||
|
||
$ ansys-launcher configure ACP direct | ||
|
||
binary_path: | ||
Path to the ACP gRPC server executable. | ||
[/usr/ansys_inc/v242/ACP/acp_grpcserver]: | ||
|
||
stdout_file: | ||
File in which the server stdout is stored. | ||
[/dev/null]: | ||
|
||
stderr_file: | ||
File in which the server stderr is stored. | ||
[/dev/null]: | ||
|
||
Overwrite default launch mode for ACP (currently set to 'docker_compose')? [y/N]: Y | ||
|
||
Updated ~/.config/ansys_tools_local_product_launcher/config.json | ||
|
||
The new configuration will be used by the :func:`.launch_acp` function. Note that you | ||
Check warning on line 57 in doc/source/howto/launch_configuration.rst GitHub Actions / vale[vale] doc/source/howto/launch_configuration.rst#L57
Raw output
|
||
may have to restart your Python session for the changes to take effect. | ||
|
||
Choosing the launch mode at runtime | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
To switch between the launch modes, you can specify the ``launch_mode`` argument | ||
when calling :func:`.launch_acp`. Note that the selected launch mode must be | ||
already configured with ``ansys-launcher``. | ||
|
||
.. testcode:: | ||
|
||
import ansys.acp.core as pyacp | ||
|
||
acp = pyacp.launch_acp(launch_mode="docker_compose") | ||
|
||
The ``config`` parameter can be used to fully customize the launch of ACP at runtime. | ||
This parameter expects a configuration object matching the selected ``launch_mode``: | ||
- :class:`.DirectLaunchConfig` for the ``direct`` launch mode. | ||
- :class:`.DockerComposeLaunchConfig` for the ``docker_compose`` launch mode. | ||
|
||
.. testcode:: | ||
|
||
import os | ||
import ansys.acp.core as pyacp | ||
|
||
acp = pyacp.launch_acp( | ||
config=pyacp.DockerComposeLaunchConfig( | ||
image_name_pyacp="ghcr.io/ansys-internal/pyacp:latest", | ||
image_name_filetransfer="ghcr.io/ansys-internal/tools-filetransfer:latest", | ||
keep_volume=True, | ||
license_server=f"1055@{os.environ['LICENSE_SERVER']}", | ||
), | ||
launch_mode="docker_compose", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this relies on the
LICENSE_SERVER
env variable to be set; this works in CI, but may or may not work locally.