We've run into a couple of issues when trying to automate DICOM uploads into our XNAT (1.8.10.1), using XNATPY.
We were able to run our script for 12+ hours, uploading multiple MRI sessions in the process, but eventually this line failed and gave us:
Exception in thread XNATpyKeepAliveThread:
Traceback (most recent call last):
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
self.run()
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/site-packages/xnat/session.py", line 249, in _keepalive_thread_run
self.heartbeat()
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/site-packages/xnat/session.py", line 240, in heartbeat
self.get('/data/JSESSION', timeout=10)
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/site-packages/xnat/session.py", line 376, in get
self._check_response(response, accepted_status=accepted_status, uri=uri) # Allow OK, as we want to get data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/site-packages/xnat/session.py", line 326, in _check_response
raise exceptions.XNATResponseError(
xnat.exceptions.XNATResponseError: Invalid status for response from XNATSession for url
https://test-xnat.win.ox.ac.uk/data/JSESSION (status 502, accepted status: [200])
prearchive_session.archive(overwrite="delete", trigger_pipelines=False)
We have been running into an issue with the archive command and after 10 minutes (almost exactly) we get an error response that looks to be a form of timeout, although eventually the archive process does complete.
2024-05-29 16:13:36,552 - siemens_xnat_upload - ERROR - Invalid status for response from XNATSession for url
https://test-xnat.win.ox.ac.uk/data/services/archive?src=/data/prearchive/projects/2021_015/20240529_154643551/F3T_2021_015_043-DICOM&auto-archive=false&overwrite=delete&triggerPipelines=false (status 500, accepted status: [200, 201])
Traceback (most recent call last):
File "/home/flitney_local/git/twix-xnat-relay/tasks.py", line 158, in process_dicom_folder
dicom_upload(session, project, subject, experiment, zipped_dicoms)
File "/home/flitney_local/git/twix-xnat-relay/tasks.py", line 140, in dicom_upload
prearchive_session.archive(overwrite="delete", trigger_pipelines=False)
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/site-packages/xnat/prearchive.py", line 241, in archive
response =
self.xnat_session.post('/data/services/archive', query=query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/site-packages/xnat/session.py", line 448, in post
self._check_response(response, accepted_status=accepted_status, uri=uri)
File "/home/flitney_local/.conda/envs/xnat-relay/lib/python3.12/site-packages/xnat/session.py", line 326, in _check_response
raise exceptions.XNATResponseError(
xnat.exceptions.XNATResponseError: Invalid status for response from XNATSession for url
https://test-xnat.win.ox.ac.uk/data/services/archive?src=/data/prearchive/projects/2021_015/20240529_154643551/F3T_2021_015_043-DICOM&auto-archive=false&overwrite=delete&triggerPipelines=false (status 500, accepted status: [200, 201])
Other than increasing our nginx timeout values (which has previously fixed timeout issues, and are set much higher than 10 minutes) I'm not sure where else this might be limited by.
I'm not sure if either of these are XNAT or XNATPy (or both) related, but any ideas or suggestions would be appreciated.
Thanks,
Duncan