Skip to content

Commit e13cbb2

Browse files
committed
update yaml pipelines:
update used server versions add unit test files remove some test on linux add kill servers tasks add publish test results tasks add pytest rerun failed tests fix package installation use standalone server on linux
1 parent 8a09e33 commit e13cbb2

36 files changed

+9680
-126
lines changed

.ci/azure-pipelines.yml

Lines changed: 108 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,19 @@ jobs:
3333

3434
steps:
3535
- powershell: |
36-
powershell .ci/install_opengl.ps1
36+
Set-StrictMode -Version Latest
37+
$ErrorActionPreference = "Stop"
38+
$PSDefaultParameterValues['*:ErrorAction']='Stop'
39+
git clone --depth 1 git://github.com/pyvista/gl-ci-helpers.git
40+
powershell gl-ci-helpers/appveyor/install_opengl.ps1
41+
displayName: 'Install OpenGL'
42+
43+
- powershell: |
3744
.ci/setup_headless_display.sh
3845
pip install -r .ci/requirements_test_xvfb.txt
3946
python .ci/display_test.py
40-
displayName: Install and start a virtual framebuffer
41-
47+
displayName: Install test offscreen rendering
48+
4249
- task: UsePythonVersion@0
4350
inputs:
4451
versionSpec: $(python.version)
@@ -52,7 +59,9 @@ jobs:
5259
- script: |
5360
pip install -r requirements_build.txt
5461
python setup.py bdist_wheel
55-
pip install --find-links=dist ansys_dpf_core
62+
FOR /F %%a in ('dir /s/b dist\*.whl') do SET WHEELNAME=%%a
63+
ECHO %WHEELNAME%
64+
pip install %WHEELNAME%
5665
cd tests
5766
python -c "from ansys.dpf import core; print(core.Report(gpu=False))"
5867
displayName: Install ansys-dpf-core
@@ -63,46 +72,59 @@ jobs:
6372
downloadDirectory: '$(System.DefaultWorkingDirectory)'
6473
feedsToUse: 'internal'
6574
vstsFeed: '705e121a-9631-49f5-8aaf-c7142856f923'
66-
vstsFeedPackage: 'f913c1d3-1fe4-404c-8c28-15a234e56803' #TODO: update hash of packages
67-
vstsPackageVersion: '21.2.0'
75+
vstsFeedPackage: 'dpf-windows' #TODO: update hash of packages
76+
vstsPackageVersion: '21.2.3'
6877

6978
- script: |
7079
@echo on
71-
dir $(System.DefaultWorkingDirectory)
80+
dir $(System.DefaultWorkingDirectory)\server\v212\aisol\bin\winx64
7281
set THISDIR=$(System.DefaultWorkingDirectory)
7382
cd %THISDIR%\server\v212\aisol\bin\winx64
7483
START /B Ans.Dpf.Grpc.bat --address 127.0.0.1 --port %DPF_PORT% > log.txt 2>&1
75-
python -c "from ansys.dpf import core; core.connect_to_server(port=$(DPF_PORT)); print('Python Connected')"
84+
python -c "from ansys.dpf import core; core.connect_to_server(port=$(DPF_PORT)); print('Python Connected')"
7685
displayName: Start DPF Server
7786
7887
- script: |
7988
pip install -r requirements_test.txt
80-
cd tests
81-
pytest -v --junitxml=junit/test-results.xml --cov ansys.dpf.core --cov-report=xml
89+
set THISDIR=$(System.DefaultWorkingDirectory)
90+
cd tests=$(System.DefaultWorkingDirectory)
91+
set AWP_ROOT212=%THISDIR%\server\v212
92+
pytest -v --junitxml=junit/test-results.xml --cov ansys.dpf.core --cov-report=xml --reruns 3
93+
8294
displayName: Test Core API
95+
96+
- task: PublishTestResults@2
97+
inputs:
98+
testResultsFormat: 'JUnit'
99+
testResultsFiles: 'junit/test-results.xml'
100+
testRunTitle: 'windowsTests'
101+
publishRunAttachments: true
102+
condition: always()
83103

84104
- script: |
85105
type $(System.DefaultWorkingDirectory)\server\v212\aisol\bin\winx64\log.txt
86106
displayName: 'Show DPF Server Logs'
87107
condition: always()
108+
109+
- script : |
110+
tasklist /FI "IMAGENAME eq Ans.Dpf.Grpc.exe" 2>NUL | find /I /N "Ans.Dpf.Grpc.exe">NUL
111+
ECHO %ERRORLEVEL%
112+
if "%ERRORLEVEL%"=="0"(taskkill /f /im Ans.Dpf.Grpc.exe)
113+
displayName: 'Kill all servers'
114+
condition: always()
115+
continueOnError: true
116+
88117
89118
- job: Linux
90119
variables:
91120
python.version: '3.7' # due to VTK 8.1.2 requirement for docbuild
92121
DISPLAY: ':99.0'
93122
PYANSYS_OFF_SCREEN: True
94-
DPF_PORT: 32772
95-
DPF_START_SERVER: False
96-
DPF_IMAGE: docker.pkg.github.com/pyansys/dpf-core/dpf:
97-
DPF_DOCKER: True
123+
DPF_PORT: 50055
124+
TEMP: $(System.DefaultWorkingDirectory)/temp
125+
98126
pool:
99127
vmImage: 'ubuntu-20.04'
100-
strategy:
101-
matrix:
102-
DPF2021R1:
103-
DPF.VERSION: 'v2021.1'
104-
DPF2021R2:
105-
DPF.VERSION: 'v2021.2'
106128
steps:
107129
- task: UsePythonVersion@0
108130
inputs:
@@ -123,26 +145,69 @@ jobs:
123145
- script: |
124146
pip install -r requirements_build.txt
125147
python setup.py bdist_wheel
126-
pip install --find-links=dist ansys_dpf_core
148+
export WHEELNAME=`ls dist/*.whl`
149+
echo ${WHEELNAME}
150+
pip install ${WHEELNAME}
127151
cd tests
128152
python -c "from ansys.dpf import core; print(core.Report())"
129153
displayName: Install ansys-dpf-core
130154
155+
- task: UniversalPackages@0
156+
inputs:
157+
command: 'download'
158+
downloadDirectory: '$(System.DefaultWorkingDirectory)'
159+
feedsToUse: 'internal'
160+
vstsFeed: '705e121a-9631-49f5-8aaf-c7142856f923'
161+
vstsFeedPackage: 'dpf-linux' #TODO: update hash of packages
162+
vstsPackageVersion: '21.2.5'
163+
164+
- script : |
165+
echo $0
166+
if pgrep -x "Ans.Dpf.Grpc" > /dev/null
167+
then
168+
pkill -f Ans.Dpf.Grpc.exe
169+
fi
170+
displayName: 'Kill all servers'
171+
condition: always()
172+
continueOnError: true
173+
131174
- script: |
132-
set -ex
133-
echo $(PAT) | docker login -u $(GH_USERNAME) --password-stdin docker.pkg.github.com
134-
docker pull $(DPF_IMAGE)
135-
docker run --restart always --name dpf -v `pwd`:/dpf -v /tmp:/dpf/_cache -p $(DPF_PORT):50054 $(DPF_IMAGE) > log.txt &
136-
grep -q 'server started on ip' <(timeout 60 tail -f log.txt)
137-
python -c "from ansys.dpf import core as dpf; dpf.connect_to_server(port=$(DPF_PORT)); print('Python Connected')"
138-
displayName: Pull, launch, and validate DPF service
139-
175+
env
176+
displayName: Display env
177+
178+
- script: |
179+
echo $0
180+
export THISDIR=${SYSTEM_DEFAULTWORKINGDIRECTORY}
181+
echo ${THISDIR}
182+
export AWP_ROOT212=${THISDIR}/server/v212
183+
cd ${THISDIR}/server/v212/aisol/bin/linx64
184+
pwd
185+
chmod 755 Ans.Dpf.Grpc.sh
186+
chmod 755 Ans.Dpf.Grpc.exe
187+
./Ans.Dpf.Grpc.sh --port 50054 & > log.txt
188+
export DPF_IP=$(hostname -i)
189+
python -c "from ansys.dpf import core; core.connect_to_server(ip= '${DPF_IP}', port=50054); print('Python Connected')"
190+
displayName: Start DPF Server
191+
140192
- script: |
141193
pip install -r requirements_test.txt
142-
pip install pytest-azurepipelines
194+
pip install pytest-azurepipelines
195+
export AWP_ROOT212=${SYSTEM_DEFAULTWORKINGDIRECTORY}/server/v212
143196
cd tests
144-
pytest -v --junitxml=junit/test-results.xml --cov ansys.dpf.core --cov-report=xml --cov-report=html
197+
export DPF_IP=$(hostname -i)
198+
pytest -v --junitxml=junit/test-results.xml --cov ansys.dpf.core --cov-report=xml --reruns 3
199+
export PATH=`pwd`
200+
echo ${PATH}
145201
displayName: Test Core API
202+
203+
- task: PublishTestResults@2
204+
inputs:
205+
testResultsFormat: 'JUnit'
206+
testResultsFiles: 'junit/test-results.xml'
207+
testRunTitle: 'linuxTests'
208+
publishRunAttachments: true
209+
searchFolder: 'tests/'
210+
condition: always()
146211

147212
- script: |
148213
pip install twine
@@ -154,3 +219,15 @@ jobs:
154219
TWINE_USERNAME: __token__
155220
TWINE_PASSWORD: $(PYPI_TOKEN)
156221
TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/"
222+
223+
- script : |
224+
echo $0
225+
if pgrep -x "Ans.Dpf.Grpc" > /dev/null
226+
then
227+
pkill -f Ans.Dpf.Grpc.exe
228+
fi
229+
displayName: 'Kill all servers'
230+
condition: always()
231+
continueOnError: true
232+
233+

.ci/install_opengl.ps1

Lines changed: 0 additions & 51 deletions
This file was deleted.

.ci/requirements_test_xvfb.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
pyvista>=0.27.2
2+
matplotlib==3.2

ansys/dpf/core/core.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -348,23 +348,26 @@ def load_library(self, filename, name='', symbol="LoadOperators"):
348348
except Exception as e:
349349
raise IOError(f'Unable to load library "{filename}". File may not exist or'
350350
f' is missing dependencies:\n{str(e)}')
351-
352-
local_dir =os.path.dirname(os.path.abspath(__file__))
353-
LOCAL_PATH = os.path.join(local_dir, "operators")
354351

355-
#send local generated code
356-
TARGET_PATH = self.make_tmp_dir_server()
357-
self.upload_files_in_folder(TARGET_PATH, LOCAL_PATH, "py")
352+
#TODO: fix code generation upload posix
353+
import os
354+
if os.name != 'posix':
355+
local_dir =os.path.dirname(os.path.abspath(__file__))
356+
LOCAL_PATH = os.path.join(local_dir, "operators")
357+
358+
#send local generated code
359+
TARGET_PATH = self.make_tmp_dir_server()
360+
self.upload_files_in_folder(TARGET_PATH, LOCAL_PATH, "py")
361+
362+
#generate code
363+
from ansys.dpf.core.dpf_operator import Operator
364+
code_gen = Operator("python_generator")
365+
code_gen.connect(1,TARGET_PATH)
366+
code_gen.connect(0, filename)
367+
code_gen.connect(2, False)
368+
code_gen.run()
358369

359-
#generate code
360-
from ansys.dpf.core.dpf_operator import Operator
361-
code_gen = Operator("python_generator")
362-
code_gen.connect(1,TARGET_PATH)
363-
code_gen.connect(0, filename)
364-
code_gen.connect(2, False)
365-
code_gen.run()
366-
367-
self.download_files_in_folder(TARGET_PATH, LOCAL_PATH,"py")
370+
self.download_files_in_folder(TARGET_PATH, LOCAL_PATH,"py")
368371

369372

370373
@property

ansys/dpf/core/dpf_operator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323

2424
class Operator:
2525
"""A class used to represent an Operator which is an elementary
26-
operation.
26+
operation.The Operator is the only object used to create and
27+
transform the data. When the operator is evaluated, it will
28+
process the input information to compute its output with respect
29+
to its description.
2730
2831
A list of existing operators can be asked through the "html_doc"
2932
operator.
40 KB
Binary file not shown.
1.12 MB
Binary file not shown.
56 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SOLV_MPA

0 commit comments

Comments
 (0)