events logic and untriggering GirderUploadToItem


I wonder if you can briefly explain/ advise the best way to deal with the situation:

The scenario is the following

  • the user upload via the girder interface a file input.nii.gz
  • an event is trigger using the extension of the file for instance and
events.bind('model.upload.assetstore', 'assetstore', _modelUploadAssetstore)  


events.bind('', 'created', _modelFileSaveCreated) 
  • and a plugin create a job run in girder worker which output another file named output.nii.gz
    that is upload back to the girder database using

this is resulting in an infinite loop.

A way to solve it is to hard code if/else conditions based on the name file/item/folder.
Another mechanism is mentioned in the api for girder.models.model_base. Model using for instance:

save (*document*, *validate=True*, *triggerEvents=False )

Or in few word, do you have any recommendation for untriggering event related to upload of a job result via GirderUploadToItem ?

Thanks in advance,