ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
423 stars 120 forks source link

Test not stopping MAPDL instances properly #3254

Open germa89 opened 2 months ago

germa89 commented 2 months ago

Many tests have failed with ansys.mapdl.core.errors.PortAlreadyInUseByAnMAPDLInstance because it seems the tests do not exit MAPDL properly.

https://github.com/ansys/pymapdl/actions/runs/9853958688/job/27205817273?pr=3252#step:10:2585

germa89 commented 2 months ago

I should probably do a decorator that kills all the other instances. I should be careful of pool module.

germa89 commented 2 months ago

I should also check mapdl.exit() works properly

germa89 commented 2 months ago

Additionally, the test test_map_timeout is giving error.

I'm not sure why it started now to show up after few PR merged without issues. I think it is again #3251. I'm going to disable all the pool tests failing:

tests/test_launcher.py::test_license_product_argument[ansys-Ansys Mechanical Enterprise] PASSED [ 42%]
tests/test_launcher.py::test_license_product_argument[meba-Ansys Mechanical Enterprise Solver] PASSED [ 42%]
tests/test_launcher.py::test_license_product_argument[mech_2-Ansys Mechanical Premium] PASSED [ 42%]
tests/test_launcher.py::test_license_product_argument[mech_1-Ansys Mechanical Pro] PASSED [ 43%]
tests/test_launcher.py::test_license_product_argument_type_error[1] PASSED [ 43%]
tests/test_parameters.py::test_parameters_name_error[Not valid sign ?-run] PASSED [ 84%]
tests/test_parameters.py::test_parameters_name_error[Not valid sign ?-get] PASSED [ 84%]
tests/test_parameters.py::test_parameters_name_error[Not valid sign ?-_check_parameter_name] PASSED [ 84%]
tests/test_parameters.py::test_parameters_name_error[Not valid sign ?-parameters] PASSED [ 84%]
tests/test_parameters.py::test_contain_iter PASSED                       [ 84%]
tests/test_parameters.py::test_double_parameter_get[0.3333333333333333] PASSED [ 84%]
tests/test_parameters.py::test_double_parameter_get[0.14285714285714285] PASSED [ 84%]
tests/test_parameters.py::test_double_parameter_get[0.018168181681681616] PASSED [ 84%]
tests/test_parameters.py::test_parameter_delete_raise PASSED             [ 84%]
tests/test_parameters.py::test_interp_star_status[PARAMETER STATUS- PORT  (     12 PARAMETERS DEFINED)\n                  (INCLUDING        3 INTERNAL PARAMETERS)\n\n NAME                              VALUE                        TYPE  DIMENSIONS\n PORT                              50054.0000                  SCALAR-50054] PASSED [ 84%]
tests/test_parameters.py::test_interp_star_status[PARAMETER STATUS- ASDF  (      5 PARAMETERS DEFINED)\n                  (INCLUDING        3 INTERNAL PARAMETERS)\n\n      LOCATION                VALUE\n        1       1       1    1.00000000\n        2       1       1    2.00000000\n        3       1       1    3.00000000\n        4       1       1    4.00000000-check1] PASSED [ 84%]
tests/test_parameters.py::test_interp_star_status[\nPARAMETER STATUS- MYARR  (      6 PARAMETERS DEFINED)\n                  (INCLUDING        3 INTERNAL PARAMETERS)\n\n      LOCATION                VALUE\n        1       1       1    1.00000000\n        2       1       1    1.00000000\n        3       1       1    2.00000000\n        1       2       1    0.00000000\n        2       2       1    0.00000000\n        3       2       1    0.00000000\n        1       3       1    0.00000000\n        2       3       1    0.00000000\n        3       3       1    0.00000000\n        1       1       2    1.00000000\n        2       1       2    2.00000000\n        3       1       2    3.00000000\n        1       2       2    0.00000000\n        2       2       2    0.00000000\n        3       2       2    0.00000000\n        1       3       2    0.00000000\n        2       3       2    0.00000000\n        3       3       2    0.00000000\n        1       1       3    1.00000000\n        2       1       3    2.00000000\n        3       1       3    3.00000000\n        1       2       3    1.00000000\n        2       2       3    2.00000000\n        3       2       3    3.00000000\n        1       3       3    0.00000000\n        2       3       3    0.00000000\n        3       3       3    0.00000000-check2] PASSED [ 84%]
tests/test_parameters.py::test_interp_star_status[PARAMETER STATUS- MYSTR3  (     12 PARAMETERS DEFINED)\n                  (INCLUDING        3 INTERNAL PARAMETERS)\n       96       1       1  aqzzzxcv zx zxcv   zxcv\n\n       96       2       1  qwer wer qwer\n\n       96       3       1  zxcv-check3] PASSED [ 84%]
tests/test_parameters.py::test_interp_star_status[ABBREVIATION STATUS-\n\n  ABBREV    STRING\n  SAVE_DB   SAVE\n  RESUM_DB  RESUME\n  QUIT      Fnc_/EXIT\n  POWRGRPH  Fnc_/GRAPHICS\n\n PARAMETER STATUS-           (     12 PARAMETERS DEFINED)\n                  (INCLUDING        3 INTERNAL PARAMETERS)\n\n NAME                              VALUE                        TYPE  DIMENSIONS\n ASDF                                       STRING ARRAY       8       1       1\n MYARR                                             ARRAY       1       1       1\n MYSTR                                      STRING ARRAY      96       3       1\n MYSTR3                                     STRING ARRAY      96       3       1\n PGFZJK_COLDIM                     1.00000000                  SCALAR\n PGFZJK_DIM                        20.0000000                  SCALAR\n PGFZJK_ROWDIM                     20.0000000                  SCALAR\n PORT                              50054.0000                  SCALAR\n STRARRAY                                   STRING ARRAY      96       1       1-None] PASSED [ 85%]
tests/test_parameters.py::test_str_arrays PASSED                         [ 85%]
tests/test_parameters.py::test_3d_array PASSED                           [ 85%]
tests/test_parameters.py::test_parameter_with_spaces PASSED              [ 85%]
tests/test_parameters.py::test_parameters_keys PASSED                    [ 85%]
tests/test_parameters.py::test_parameters_values PASSED                  [ 85%]
tests/test_parameters.py::test_parameters_copy PASSED                    [ 85%]
tests/test_parameters.py::test_parameters_items PASSED                   [ 85%]
tests/test_parameters.py::test_parameter_contains PASSED                 [ 85%]
tests/test_parameters.py::test_non_existing_parameter PASSED             [ 85%]
tests/test_parameters.py::test_non_interactive PASSED                    [ 85%]
tests/test_pool.py::test_invalid_exec SKIPPED (Requires MAPDL 194)       [ 85%]
tests/test_pool.py::test_heal RERUN                                      [ 85%]
tests/test_pool.py::test_heal RERUN                                      [ 85%]
tests/test_pool.py::test_heal RERUN                                      [ 85%]
tests/test_pool.py::test_heal FAILED                                     [ 85%]
tests/test_pool.py::test_simple_map PASSED                               [ 85%]
##[debug]Re-evaluate condition on job cancellation for step: 'Unit testing'.
tests/test_pool.py::test_map_timeout 
Error: The operation was canceled.
##[debug]System.OperationCanceledException: The operation was canceled.
##[debug]   at System.Threading.CancellationToken.ThrowOperationCanceledException()
##[debug]   at GitHub.Runner.Sdk.ProcessInvoker.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Channel`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
##[debug]   at GitHub.Runner.Common.ProcessInvokerWrapper.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Channel`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
##[debug]   at GitHub.Runner.Worker.Handlers.ContainerStepHost.ExecuteAsync(IExecutionContext context, String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Boolean inheritConsoleHandler, String standardInInput, CancellationToken cancellationToken)
##[debug]   at GitHub.Runner.Worker.Handlers.ScriptHandler.RunAsync(ActionRunStage stage)
##[debug]   at GitHub.Runner.Worker.ActionRunner.RunAsync()
##[debug]   at GitHub.Runner.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
##[debug]Finishing: Unit testing