ome/omero-server

`omero script replace` "loses" official script if invalid

Opened this issue · 1 comments

The workflow:

omero script upload --official my-script.py
# Begin loop
omero script replace /my-script.py my-script.py
# End loop

is a fast method of developing a script in OMERO. However, if the script is invalid, a subsequent call to replace will fail since the original script is no longer in place. The Script service should likely catch the exception and attempt to roll back the change:

$ omero script replace /my-script.py my-script.py
Using session for root@localhost:4064. Idle timeout: 10 min. Current group: system
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/omero-transfer/bin/omero", line 10, in <module>
    sys.exit(main())
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/omero-transfer/lib/python3.10/site-packages/omero/main.py", line 126, in main
    rv = omero.cli.argv()
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/omero-transfer/lib/python3.10/site-packages/omero/cli.py", line 1787, in argv
    cli.invoke(args[1:])
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/omero-transfer/lib/python3.10/site-packages/omero/cli.py", line 1225, in invoke
    stop = self.onecmd(line, previous_args)
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/omero-transfer/lib/python3.10/site-packages/omero/cli.py", line 1302, in onecmd
    self.execute(line, previous_args)
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/omero-transfer/lib/python3.10/site-packages/omero/cli.py", line 1384, in execute
    args.func(args)
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/omero-transfer/lib/python3.10/site-packages/omero/plugins/script.py", line 681, in replace
    scriptSvc.editScript(ofile, scriptText)
  File "/opt/homebrew/Caskroom/mambaforge/base/envs/omero-transfer/lib/python3.10/site-packages/omero_api_IScript_ice.py", line 767, in editScript
    return _M_omero.api.IScript._op_editScript.invoke(self, ((fileObject, scriptText), _ctx))
omero.ValidationException: exception ::omero::ValidationException
{
    serverStackTrace =
    serverExceptionClass =
    message = Can't find params for 86!
No stdout.
stderr is in file 109:
---------------------------------
  File "/opt/omero/server/omero/tmp/omero_omero-server/1023/processw_905ozx.dir/./script", line 55
    pre_arguments = [
    ^
SyntaxError: invalid syntax

---------------------------------

}

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/omero-scripts-storage-state-question/92108/2