Skip to content

Commit

Permalink
Merge branch 'pre-commit-ci-update-config' of https://github.com/pyan…
Browse files Browse the repository at this point in the history
…sys/pymapdl into pre-commit-ci-update-config
  • Loading branch information
germa89 committed Oct 31, 2023
2 parents 30a7ac0 + b402429 commit b3cbd27
Show file tree
Hide file tree
Showing 900 changed files with 1,504,807 additions and 5,421 deletions.
5 changes: 3 additions & 2 deletions .ci/start_mapdl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ docker run \
-e ANSYS_LOCK="OFF" \
-p $PYMAPDL_PORT:50052 \
-p $PYMAPDL_DB_PORT:50055 \
--shm-size=1gb \
-e I_MPI_SHM_LMT=shm \
$MAPDL_IMAGE \
-smp -np 2 > log.txt &
-$DISTRIBUTED_MODE -np 2 > log.txt &
grep -q 'Server listening on' <(timeout 60 tail -f log.txt)
# python -c "from ansys.mapdl.core import launch_mapdl; print(launch_mapdl())"
5 changes: 3 additions & 2 deletions .ci/start_mapdl_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ docker run \
-e ANSYS_LOCK="OFF" \
-p $PYMAPDL_PORT:50052 \
-p $PYMAPDL_DB_PORT:50055 \
--shm-size=1gb \
-e I_MPI_SHM_LMT=shm \
-w /jobs \
-u=0:0 \
$MAPDL_IMAGE /ansys_inc/v222/ansys/bin/mapdl -grpc -dir /jobs -smp -np 2 > log.txt &
$MAPDL_IMAGE /ansys_inc/v222/ansys/bin/mapdl -grpc -dir /jobs -$DISTRIBUTED_MODE -np 2 > log.txt &
grep -q 'Server listening on' <(timeout 60 tail -f log.txt)
# python -c "from ansys.mapdl.core import launch_mapdl; print(launch_mapdl())"
34 changes: 21 additions & 13 deletions .devcontainer/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This guide guides you on how to develop PyMAPDL features or fix bugs using
a `remote container <https://code.visualstudio.com/docs/devcontainers/containers>`_
or `Codespaces <https://github.com/features/codespaces>`_.
The files for setting up the container can be found in the
`.devcontainer directory <https://github.com/pyansys/pymapdl/tree/main/.devcontainer>`_.
`.devcontainer directory <https://github.com/ansys/pymapdl/tree/main/.devcontainer>`_.

About the MAPDL container
=========================
Expand All @@ -24,7 +24,7 @@ If you want to build your own docker image, visit the following link
Develop on a remote container
=============================

.. note:: If you are an Ansys employee or collaborator and want to use this development method, please email |pyansys_contact|.
.. note:: If you are an Ansys employee or collaborator and want to use this development method, please email `PyAnsys Core team <pyansys_core_>`_.

To use a `remote container <https://code.visualstudio.com/docs/devcontainers/containers>`_, you must install:

Expand All @@ -39,7 +39,7 @@ As mentioned before, you must have your own Docker image with MAPDL installed lo
online registry, i.e. GitHub `ghcr.io <https://github.com/features/packages>`_.
For the purpose of this document, assume your image is hosted at ``ghcr.io/myaccount/mapdlimage:mytag``.

You must then modify the file `docker-compose.yml <https://github.com/pyansys/pymapdl/tree/main/.devcontainer/docker-compose.yml>`_
You must then modify the file `docker-compose.yml <https://github.com/ansys/pymapdl/tree/main/.devcontainer/docker-compose.yml>`_
with your custom image:

.. code-block:: yaml
Expand All @@ -50,10 +50,10 @@ with your custom image:
- '50055:50055'
image: 'ghcr.io/myaccount/mapdlimage:mytag'
user: "0:0"
volumes:
.. warning:: Also you might need to change some environment variables or Docker options to adjust to your image configuration.
For example you might need to change the :envvar:`AWP_ROOT222` if you MAPDL container does not have the installation in the default directory.
Be careful to not commit those changes in your PRs.

You can now open the current folder (or PyMAPDL repository) using
Expand All @@ -76,22 +76,30 @@ License
-------

As mentioned before, you must have a valid license to run MAPDL.
When you launch the container, the file :file:`script.sh` automatically checks if the environment
variable :envvar:`ANSYSLMD_LICENSE_FILE` exists.
When you launch the container, the file :file:`script.sh` automatically
checks if the environment variable :envvar:`ANSYSLMD_LICENSE_FILE` exists.
This environment variable sets the port and IP address of the license server.
If you do not have set this environment variable before launching the
container, you are prompt to enter your license server port and address.

If you do not have set this environment variable before launching the container, you are prompt to enter
your license server port and address.

You can set your license using the environment variable :envvar:`ANSYSLMD_LICENSE_FILE` from the terminal before launching
VS Code. This is recommended if you are using Windows OS.
For example, if you have a license server at the address ``123.45.67.89``, you can set the license using:
You can set the environment variable :envvar:`ANSYSLMD_LICENSE_FILE`
from the terminal before launching VS Code.
This is recommended if you are using Windows OS.
For example, if you have a license server at the address ``123.45.67.89``,
you can set the license using:

.. code:: pwsh-session
$env:ANSYSLMD_LICENSE_FILE = '[email protected]'
code . # launch VS Code
On Linux

.. code:: bash
$ export ANSYSLMD_LICENSE_FILE [email protected]
code . # launch VS Code
And then open the folder in the container using the *Command palette*.


Expand All @@ -103,5 +111,5 @@ You can launch a container which all the required tools and start to work in cou
This is an easy way to get started with PyMAPDL development.

.. warning:: This method is only applicable and allowed to Ansys employees or collaborators.
If you are an Ansys employee and wants use this development method, please email |pyansys_contact|.
If you are an Ansys employee and wants use this development method, please email `PyAnsys Core team <pyansys_core_>`_.

15 changes: 4 additions & 11 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",
// Uncomment the next line to run commands after the container is created - for example installing curl.
"postCreateCommand": "/bin/bash ./.devcontainer/script.sh", //"'pkill -9 -f ansys_inc/v222/ansys'",
"postCreateCommand": "/bin/bash ./.devcontainer/script.sh",

// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "root",
Expand All @@ -35,20 +35,13 @@
]
},
"vscode": {
"openFiles": [
".devcontainer/README.rst"
],
"extensions": [
"hbenl.vscode-test-explorer",
"LittleFoxTeam.vscode-python-test-adapter",
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-ssh-edit",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-wsl",
"ms-vscode-remote.vscode-remote-extensionpack",
"ms-vscode.remote-explorer",
"njpwerner.autodocstring",
"VisualStudioExptTeam.vscodeintellicode",
"yzhang.markdown-all-in-one",
]
}
}
Expand Down
61 changes: 24 additions & 37 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,38 @@
# Requirements
# ------------
#
# You should have a valid `ANSYSLMD_LICENSE_FILE` env var. For example:
#
# $ ANSYSLMD_LICENSE_FILE=1055@myserver
#
# This env var will be copied to the container `.bashrc` file so it will
# be available in the future runs.
# If you do not have a valid env var when starting the container, you will
# be prompted through the terminal to input a valid port and IP for the
# license server.

version: '3.3'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
mapdldev:
# If you want add a non-root user to your Dockerfile, you can use the "remoteUser"
# property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks,
# debugging) to execute as the user. Uncomment the next line if you want the entire
# container to run as this user instead. Note that, on Linux, you may need to
# ensure the UID and GID of the container user you create matches your local user.
# See https://aka.ms/vscode-remote/containers/non-root for details.
#
# user: vscode

# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile
restart: always
shm_size: '8gb'
shm_size: '8gb' # Increase the shared memory directory
# to avoid running issues. By Default this is very small (64MB)
container_name: mapdldev
mem_reservation: 8g
environment:
- ANSYS_LOCK=OFF
- AWP_ROOT222=/ansys_inc
- ANSYSLMD_LICENSE_FILE=${ANSYSLMD_LICENSE_FILE}
- PYANSYS_OFF_SCREEN=true
- ANSYS_LOCK=OFF # Avoid lock file creation.
- AWP_ROOT222=/ansys_inc # Specifying the installation directory
- ANSYSLMD_LICENSE_FILE=${ANSYSLMD_LICENSE_FILE} # License server env var
- PYANSYS_OFF_SCREEN=true # To avoid plotting.
ports:
- '50052:50052'
- '50055:50055'
image: 'ghcr.io/pyansys/mapdl:v22.2-ubuntu'
- '50042:50052' # For the gRPC server
- '50045:50055' # For the DB server
image: 'ghcr.io/ansys/mapdl:v22.2-ubuntu'
user: "0:0"
volumes:
# Update this to wherever you want VS Code to mount the folder of your project
# Update this to wherever you want VS Code to mount the folder of your project inside the container.
- ../:/local:cached

# Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details.
# - /var/run/docker.sock:/var/run/docker.sock

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
# - SYS_PTRACE
# security_opt:
# - seccomp:unconfined

# Overrides default command so things don't shut down after the process ends.
entrypoint: /bin/bash -c "echo 'Container is ready. You can now attach to it.'; while sleep 10000; do :; done"
entrypoint: /bin/bash -c "echo 'Container is ready. You can now attach to it at the port 50042'; while sleep 10000; do :; done"

15 changes: 15 additions & 0 deletions .devcontainer/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,19 @@ if [[ -z "${ANSYSLMD_LICENSE_FILE}" ]]; then
else
echo "ANSYSLMD_LICENSE_FILE was found."
echo "It is defined as ${ANSYSLMD_LICENSE_FILE}"

# Storing env var in .bashrc file so it is automatically loaded.
printf "\n%s\n" "ANSYSLMD_LICENSE_FILE=${ANSYSLMD_LICENSE_FILE}" >> ~/.bashrc

# Activating the new configuration
source ~/.bashrc

fi

# Installing libs for testing
apt update
apt install -y libgl1-mesa-glx xvfb

# Installing libs for doc building
apt update
apt install -y zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk graphviz texlive-xetex
29 changes: 7 additions & 22 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ body:
required: true
- label: I am using a [Python virtual environment](https://docs.python.org/3/library/venv.html).
required: true
- label: I am using the [latest version of PyMAPDL](https://github.com/ansys/pymapdl/releases) and its dependencies (fully updated virtual environment). You can update them using ``pip install --upgrade --upgrade-strategy eager ansys-mapdl-core``.
- label: I am using the [latest version of PyMAPDL](https://github.com/ansys/pymapdl/releases) and its dependencies (fully updated virtual environment). You can update them using ``pip install --upgrade --upgrade-strategy eager ansys-mapdl-core`` in your activated virtual environment.
required: true

- type: textarea
Expand All @@ -40,34 +40,19 @@ body:
attributes:
label: 🕵️ Steps To Reproduce
description: |
Please write the steps in a list form e.g.:
* Install this package...
* Run this input file (Please attach it) and/or
* Run the following commands:
Please write the python commands you used:
```py
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
mapdl.command1()
mapdl.command2()
...
```
* Check obtained error...
Use the following text box:
value: |
Steps:
* First I did...
* ...
And I ran the following code:
```py
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
# Insert your code here
```
value: The log will automatically be formatted as Python code! No need to type backticks.
render: Python

validations:
required: true
Expand Down
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: Questions and Discussions
url: https://github.com/ansys/pymapdl/discussions
about: For general questions and discussions
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ updates:
interval: "weekly"
day: "friday"
time: "00:00"

labels:
- "Maintenance"
- "Dependencies"
ignore:
- dependency-name: "grpcio"
- dependency-name: "sphinx"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
8 changes: 8 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,11 @@
- name: Won't fix
description: ""
color: ffffff

- name: reminder
description: "Label for the reminder bot"
color: c5def5

- name: Nightly build failed
description: "Label for the nightly fails"
color: b5f226
8 changes: 6 additions & 2 deletions .github/workflows/approver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
issue_comment:
types: [created, edited]

env:
# sintax: ("germa89" "author2")
ALLOWED_AUTHORS: ("germa89")

jobs:
autoapprove:
# This job only runs for pull request comments
Expand All @@ -15,8 +19,8 @@ jobs:
steps:
- uses: hmarr/auto-approve-action@v3
if: |
contains(github.event.comment.body, 'LGTM') && contains(github.event.comment.user.login, 'germa89')
contains(github.event.comment.body, 'LGTM') && contains(env.ALLOWED_AUTHORS, github.event.comment.user.login)
with:
review-message: ":white_check_mark: Approving this PR because ${{ github.event.comment.user.login }} said so :grimacing:"
review-message: ":white_check_mark: Approving this PR because [${{ github.event.comment.user.login }}](https://github.com/${{ github.event.comment.user.login }}) said so in [here](${{ github.event.comment.html_url }}) :grimacing:"
pull-request-number: ${{ github.event.issue.number }}
github-token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
7 changes: 4 additions & 3 deletions .github/workflows/cache_cleaner.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: cleanup caches by a branch
name: Cleanup caches 🧹
on:
workflow_dispatch:
pull_request:
Expand All @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cleanup PR caches
if: github.event_name != 'workflow_dispatch'
Expand Down Expand Up @@ -40,6 +40,7 @@ jobs:
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
echo $REPO
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO | cut -f 1 )
Expand All @@ -49,7 +50,7 @@ jobs:
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm && echo "Deleting cache with key: $cacheKey"
gh actions-cache delete $cacheKey -R $REPO --confirm && echo "Deleting cache with key: $cacheKey"
done
echo "Done"
env:
Expand Down
Loading

0 comments on commit b3cbd27

Please sign in to comment.