omero-py icon indicating copy to clipboard operation
omero-py copied to clipboard

append logs for omero import

Open paulkorir opened this issue 5 years ago • 3 comments

This is a feature request.

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

paulkorir avatar Nov 17 '20 09:11 paulkorir

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?

sbesson avatar Nov 17 '20 12:11 sbesson

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.

paulkorir avatar Nov 17 '20 14:11 paulkorir

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 :)

sbesson avatar Nov 18 '20 11:11 sbesson