ome / omero-py

Python project containing Ice remoting code for OMERO
https://www.openmicroscopy.org/omero
GNU General Public License v2.0
20 stars 33 forks source link

append logs for omero import #270

Open paulkorir opened 3 years ago

paulkorir commented 3 years ago

This is a feature request.

Please consider adding an option to append logs to a given file instead overwriting the logs.

sbesson commented 3 years ago

Hi @paulkorir, thanks for the feedback. To try to clarify your use case, would this happen in the case of separate omero import calls using the same stdout/stderr output file i.e.

omero import file.tiff --file import.out --err import.err
omero import file2.tiff --file import.out --err import.err

currently overwrite import.out and import.err but you would like some mechanism for appending instead?

paulkorir commented 3 years ago

Yes. Exactly.

This useful in case the first omero import fails and there is a retry mechanism. It would be helpful to know the reason of the failure and subsequence success.

Thanks for replying so fast.

sbesson commented 3 years ago

Thanks for the extra information. As a starting point, https://github.com/ome/omero-py/pull/223 added some logic to allow appending to log files in the case of consecutive bulk imports. If this is an immediate blocker, I would think the starting point would be to update:

https://github.com/ome/omero-py/blob/edf9558ce0a6399b21dd6169aef140c00348da6e/src/omero/plugins/import.py#L668

and use mode = "a" unconditionally.

See https://github.com/ome/omero-py/pull/223#discussion_r444694596 for a related discussion about overwriting /appending/suffixing. Happy to hear your thoughts about what would make sense in terms of API. And as always, feel free to open a contribution as a PR directly against this repository :)