ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
256 stars 41 forks source link

insert_compound_child_task() error as a result of possible race condition #2586

Closed answillgm closed 4 months ago

answillgm commented 5 months ago

šŸ” Before submitting the issue

šŸž Description of the bug

Sometimes when using the fault_tolerant.identify_regions.insert_compound_child_task() function an exception is raised. This happens more often when entering code line by line than by pasting the code in a block. This doesn't consistently happen but has impeded carrying out the workflow.

The exception raised:

fault_tolerant.identify_regions.insert_compound_child_task() Exception in thread Thread-61 (_process_streaming): Traceback (most recent call last): File "python\lib\threading.py", line 1016, in _bootstrap_inner self.run() File "python\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "python\lib\site-packages\ansys\fluent\core\streaming_services\datamodel_event_streaming.py", line 70, in _process_streaming cb1 File "python\lib\site-packages\ansys\fluent\core\workflow.py", line 1238, in refresh_after_sleep _refresh_task_accessors(self) File "python\lib\site-packages\ansys\fluent\core\workflow.py", line 118, in _refresh_task_accessors _refresh_task_accessors(task) File "python\lib\site-packages\ansys\fluent\core\workflow.py", line 94, in _refresh_task_accessors tasks = obj.ordered_children(recompute=True) File "python\lib\site-packages\ansys\fluent\core\workflow.py", line 252, in ordered_children task_list = _convert_task_list_to_display_names(self._workflow, task_list) File "python\lib\site-packages\ansys\fluent\core\workflow.py", line 123, in _convert_task_list_to_display_names workflow_state = DataModelCache.get_state("workflow", workflow_root) File "python\lib\site-packages\ansys\fluent\core\data_model_cache.py", line 309, in get_state return copy.deepcopy(cache) File "python\lib\copy.py", line 146, in deepcopy y = copier(x, memo) File "python\lib\copy.py", line 230, in _deepcopy_dict for key, value in x.items(): RuntimeError: dictionary changed size during iteration False

šŸ“ Steps to reproduce

  1. Enter the code from the function test_new_fault_tolerant_workflow under tests/test_new_meshing_workflow.py line by line
  2. At some point at an instance of the line fault_tolerant.identify_regions.insert_compound_child_task() the above error will likely appear. In my testing, this happened at least once on every instance of the command I tried

šŸ’» Which operating system are you using?

Windows

šŸ“€ Which ANSYS version are you using?

24.2

šŸ Which Python version are you using?

3.10

šŸ“¦ Installed packages

2to3==1.0
ansys-api-fluent==0.3.22
ansys-api-platform-instancemanagement==1.0.0
ansys-fluent-core==0.20.dev8
ansys-hpcservices-file-management-v1==23.1.2311.26
ansys-hpcservices-file-transfer-v1==23.1.2311.26
ansys-hpcservices-global-permission-v1==23.1.2311.26
ansys-hpcservices-hardware-configuration-clusters-v1==23.1.2311.26
ansys-hpcservices-hardware-configuration-endpoints-v1==23.1.2311.26
ansys-hpcservices-hardware-configuration-queues-v1==23.1.2311.26
ansys-hpcservices-hardware-configuration-storages-v1==23.1.2311.26
ansys-hpcservices-job-management-jobs-v1==23.1.2311.26
ansys-hpcservices-job-management-logs-v1==23.1.2311.26
ansys-hpcservices-job-management-templates-v1==23.1.2311.26
ansys-hpcservices-service-management-v1==23.1.2311.26
ansys-hpcservices-user-management-v1==23.1.2311.26
ansys-platform-instancemanagement==1.1.2
ansys-pythonnet==3.1.0rc0
ansys-units==0.3.1
attrs==23.2.0
beartype==0.17.2
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
clr-loader==0.2.6
colorama==0.4.6
contourpy==1.2.0
cycler==0.12.1
distro==1.9.0
docker==6.1.3
exceptiongroup==1.2.0
execnet==2.0.2
fonttools==4.49.0
future==0.18.0
googleapis-common-protos==1.52.0
grpcio==1.48.1
grpcio-health-checking==1.48.1
grpcio-status==1.26.0
h5py==3.10.0
idna==3.6
importlib_metadata==7.0.2
iniconfig==2.0.0
kiwisolver==1.4.5
llvmlite==0.39.1
lxml==4.9.4
matplotlib==3.6.0
numba==0.56.4
numpy==1.23.5
packaging==24.0
pandas==2.0.3
pillow==10.2.0
pip-system-certs==4.0
platformdirs==3.11.0
pluggy==1.4.0
protobuf==3.19.3
psutil==5.9.2
py==1.11.0
pybind11==2.10.0
pycparser==2.21
Pymem==1.13.1
pyparsing==3.1.2
pytest==7.2.1
pytest-forked==1.6.0
pytest-xdist==1.31.0
python-dateutil==2.9.0.post0
pytz==2024.1
pywin32==304
PyYAML==6.0.1
requests==2.31.0
scipy==1.9.3
SCons==4.0.1
shapely==2.0.2
sip==6.5.1
six==1.16.0
toml==0.10.2
tomli==2.0.1
tzdata==2024.1
urllib3==1.26.10
websocket-client==1.7.0
wrapt==1.16.0
zipp==3.17.0
answillgm commented 5 months ago

Also appears to sometimes happen when calling fault_tolerant.update_region_settings.all_region_overset_componen_list.set_state