comparison Sphinx/source/plugins/python.rst @ 590:404aca6160f0

warning about deadlock in python
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 07 Jan 2021 09:03:34 +0100
parents 090cc988c35e
children 2397b0e12bc8
comparison
equal deleted inserted replaced
589:759621392384 590:404aca6160f0
275 print('A new instance was uploaded: %s' % resource) 275 print('A new instance was uploaded: %s' % resource)
276 276
277 orthanc.RegisterOnChangeCallback(OnChange) 277 orthanc.RegisterOnChangeCallback(OnChange)
278 278
279 279
280
281 .. warning::
282 Your callback function will be called synchronously with
283 the core of Orthanc. This implies that deadlocks might emerge if
284 you call other core primitives of Orthanc in your callback (such
285 deadlocks are particular visible in the presence of other plugins
286 or Lua scripts). It is thus strongly advised to avoid any call to
287 the REST API of Orthanc in the callback. If you have to call other
288 primitives of Orthanc, you should make these calls in a separate
289 thread, passing the pending events to be processed through a
290 message queue.
291
292
280 Accessing the content of a new instance 293 Accessing the content of a new instance
281 ....................................... 294 .......................................
282 295
283 .. highlight:: python 296 .. highlight:: python
284 297
303 # Print the DICOM tags 316 # Print the DICOM tags
304 pprint.pprint(json.loads(dicom.GetInstanceSimplifiedJson())) 317 pprint.pprint(json.loads(dicom.GetInstanceSimplifiedJson()))
305 318
306 orthanc.RegisterOnStoredInstanceCallback(OnStoredInstance) 319 orthanc.RegisterOnStoredInstanceCallback(OnStoredInstance)
307 320
321
322 .. warning::
323 Your callback function will be called synchronously with
324 the core of Orthanc. This implies that deadlocks might emerge if
325 you call other core primitives of Orthanc in your callback (such
326 deadlocks are particular visible in the presence of other plugins
327 or Lua scripts). It is thus strongly advised to avoid any call to
328 the REST API of Orthanc in the callback. If you have to call other
329 primitives of Orthanc, you should make these calls in a separate
330 thread, passing the pending events to be processed through a
331 message queue.
332
308 333
309 Calling pydicom 334 Calling pydicom
310 ............... 335 ...............
311 336
312 .. highlight:: python 337 .. highlight:: python