Short Question regarding availability of "JobFinished/Completed" ChangeType callback for Python Plug-ins

Wondering if there is a way to capture completion of a job within a Python Plug-in ?

  1. Scenario is when running a job asynchronously, such as one of these:
  • Modifying and anonymizing DICOM instances.
  • Creating ZIP or media archives.
  • C-Move SCU (/queries/…/retrieve).
  • C-Store SCU (/modalities/…/store).
  • Sending to an Orthanc peer (/peers/…/store).
  • Split/merge.
  • Sending images using the transfers accelerator plugin.
    If run asynchronously, there are cases when it would be useful to perform some sort of clean-up task after the job is completed (e.g. reconstruction, RIS DB updates, etc.). If there were a “ChangeType_JobFinished/Completed” ChangeType that could be captured in a Python Plug-in, then the clean-up could be handled by the plug-in. Otherwise, seems like there would have to be a polling mechanism or some sort of web hook setup to deal with that.

Thanks.

You can listen to events “orthanc.ChangeType.JOB_SUBMITTED”, “orthanc.ChangeType.JOB_SUCCESS” and “orthanc.ChangeType.JOB_FAILURE” using “orthanc.RegisterOnChangeCallback()”:

https://book.orthanc-server.com/plugins/python.html#listening-to-changes

Thank you. I take it these are the implemented callbacks:

COMPLETED_SERIES
DELETED
NEW_CHILD_INSTANCE
NEW_INSTANCE
NEW_PATIENT
NEW_SERIES
NEW_STUDY
STABLE_PATIENT
STABLE_SERIES
STABLE_STUDY
ORTHANC_STARTED
ORTHANC_STOPPED
UPDATED_ATTACHMENT
UPDATED_METADATA
UPDATED_PEERS
UPDATED_MODALITIES
JOB_SUBMITTED
JOB_SUCCESS
JOB_FAILURE"

These are related:

https://groups.google.com/g/orthanc-users/c/m3FiSOrG3o8/m/nFlqBr6WAgAJ

https://bitbucket.org/osimis/orthanc-setup-samples/src/master/python-samples/python-sdk.txt

Stephen D. Scotti