E assert <TaskStatus.FAILED: 4> == <TaskStatus.COMPLETED: 3>
E + where <TaskStatus.FAILED: 4> = TaskDTO(id='a7d626b3-bba6-4a24-8854-f3e4b45716da', name='Upgrade study STA-mini (23b38929-7ee5-4e6d-b742-ddce53d3df4b)... error traceback.", return_value=None), logs=None, type='UPGRADE_STUDY', ref_id='23b38929-7ee5-4e6d-b742-ddce53d3df4b').status
E + and <TaskStatus.COMPLETED: 3> = TaskStatus.COMPLETED
------------------------------ Captured log call ------------------------------
INFO antarest.study.web.studies_blueprint:studies_blueprint.py:168 Upgrade study 23b38929-7ee5-4e6d-b742-ddce53d3df4b to the version 720
INFO antarest.core.tasks.service:service.py:368 Starting task a7d626b3-bba6-4a24-8854-f3e4b45716da
INFO antarest.core.tasks.service:service.py:373 Task a7d626b3-bba6-4a24-8854-f3e4b45716da set to RUNNING
ERROR antarest.core.tasks.service:service.py:405 Task a7d626b3-bba6-4a24-8854-f3e4b45716da failed: Unhandled exception [WinError 5] Access is denied: 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\test_upgrade_studytarget_ver0\ext_workspace\~goh6uui2.upgrade.tmp' -> 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\test_upgrade_studytarget_ver0\ext_workspace\STA-mini'
Traceback (most recent call last):
File "D:\a\AntaREST\AntaREST\antarest\core\tasks\service.py", line 376, in _run_task
result = callback(self._task_logger(task_id))
File "D:\a\AntaREST\AntaREST\antarest\study\service.py", line 260, in run_task
self._upgrade_study()
File "D:\a\AntaREST\AntaREST\antarest\study\service.py", line 226, in _upgrade_study
upgrade_study(study_path, target_version)
File "D:\a\AntaREST\AntaREST\antarest\study\storage\study_upgrader__init.py", line 95, in upgrade_study
tmp_dir.rename(study_path)
File "c:\hostedtoolcache\windows\python\3.8.10\x64\lib\pathlib.py", line 1359, in rename
self._accessor.rename(self, target)
PermissionError: [WinError 5] Access is denied: 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\test_upgrade_studytarget_ver0\ext_workspace\~goh6uui2.upgrade.tmp' -> 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\test_upgrade_study__target_ver0\ext_workspace\STA-mini'
Possible explanation and solution:
The path could already be used by another thread therefore it is locked and .rename cannot have access to it
Logs
self = <test_studies_upgrade.TestStudyUpgrade object at 0x000001878632F280> client = <starlette.testclient.TestClient object at 0x000001878684DD30> user_access_token = '***' study_id = '23b38929-7ee5-4e6d-b742-ddce53d3df4b'
------------------------------ Captured log call ------------------------------ INFO antarest.study.web.studies_blueprint:studies_blueprint.py:168 Upgrade study 23b38929-7ee5-4e6d-b742-ddce53d3df4b to the version 720 INFO antarest.core.tasks.service:service.py:368 Starting task a7d626b3-bba6-4a24-8854-f3e4b45716da INFO antarest.core.tasks.service:service.py:373 Task a7d626b3-bba6-4a24-8854-f3e4b45716da set to RUNNING ERROR antarest.core.tasks.service:service.py:405 Task a7d626b3-bba6-4a24-8854-f3e4b45716da failed: Unhandled exception [WinError 5] Access is denied: 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\test_upgrade_studytarget_ver0\ext_workspace\~goh6uui2.upgrade.tmp' -> 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\test_upgrade_studytarget_ver0\ext_workspace\STA-mini' Traceback (most recent call last): File "D:\a\AntaREST\AntaREST\antarest\core\tasks\service.py", line 376, in _run_task result = callback(self._task_logger(task_id)) File "D:\a\AntaREST\AntaREST\antarest\study\service.py", line 260, in run_task self._upgrade_study() File "D:\a\AntaREST\AntaREST\antarest\study\service.py", line 226, in _upgrade_study upgrade_study(study_path, target_version) File "D:\a\AntaREST\AntaREST\antarest\study\storage\study_upgrader__init.py", line 95, in upgrade_study tmp_dir.rename(study_path) File "c:\hostedtoolcache\windows\python\3.8.10\x64\lib\pathlib.py", line 1359, in rename self._accessor.rename(self, target) PermissionError: [WinError 5] Access is denied: 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\test_upgrade_studytarget_ver0\ext_workspace\~goh6uui2.upgrade.tmp' -> 'C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\test_upgrade_study__target_ver0\ext_workspace\STA-mini'
Possible explanation and solution:
The path could already be used by another thread therefore it is locked and .rename cannot have access to it