ome / omero-metadata

OMERO plugin for metadata manipulation https://www.openmicroscopy.org/omero/
GNU General Public License v2.0
7 stars 13 forks source link

Regression caused by NaN support #59

Closed sbesson closed 3 years ago

sbesson commented 3 years ago

With omero-metadata 0.8.1, trying to run omero metadata populate --context bulkmap fails with

[sbesson@pilot-idr0113-omeroreadwrite ~]$ /opt/omero/server/venv3/bin/omero metadata populate --context bulkmap Screen:2801  --cfg /uod/idr/metadata/idr0097-reicher-proteintag/screenA/idr0097-screenA-bulkmap-config.yml 
Using session for public@localhost:4064. Idle timeout: 10 min. Current group: Public
Traceback (most recent call last):
  File "/opt/omero/server/venv3/bin/omero", line 11, in <module>
    sys.exit(main())
  File "/opt/omero/server/venv3/lib64/python3.6/site-packages/omero/main.py", line 125, in main
    rv = omero.cli.argv()
  File "/opt/omero/server/venv3/lib64/python3.6/site-packages/omero/cli.py", line 1784, in argv
    cli.invoke(args[1:])
  File "/opt/omero/server/venv3/lib64/python3.6/site-packages/omero/cli.py", line 1222, in invoke
    stop = self.onecmd(line, previous_args)
  File "/opt/omero/server/venv3/lib64/python3.6/site-packages/omero/cli.py", line 1299, in onecmd
    self.execute(line, previous_args)
  File "/opt/omero/server/venv3/lib64/python3.6/site-packages/omero/cli.py", line 1381, in execute
    args.func(args)
  File "/opt/omero/server/venv3/lib64/python3.6/site-packages/omero_metadata/cli.py", line 536, in populate
    allow_nan=args.allow_nan)
TypeError: __init__() got an unexpected keyword argument 'allow_nan'

This regression comes from the NaN support introduced in https://github.com/ome/omero-metadata/pull/53 where a new allow_nan key/value pair is defined in the constructor of ParsingContext and set via the command-line --allow-nan flag.

Since the other Context objects have not been updated with the same change, passing any non-default context e.g. --context bulkmap or --context deletemap will currently fail at initialization time with the TypeError above.

An immediate workaround would be to add an allow_nan=False to the constructor of both context objects. Since this will likely be a no-op for the purpose of the other contexts, an alternative would be to use **kwargs in the constructor to handle an arbitrary number of arguments.

/cc @jburel

sbesson commented 3 years ago

Closed by #60