ome / omero-py

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

Config property for passing environment variables (see #395) #396

Open joshmoore opened 7 months ago

joshmoore commented 7 months ago

Rather than needing to update omero-py each time a new env variable needs passing to a script, this adds the

omero.processor.env_vars

property which can be updated. Likely needs more discussion since possibly this should be an "additional" list.

will-moore commented 7 months ago

Couple of tests failing: e.g.

  _________________________ TestProcess.testEnvironment2 _________________________
  [gw1] linux -- Python 3.10.13 /home/runner/work/omero-py/omero-py/.tox/py310/bin/python

  self = <test_processor.TestProcess object at 0x7fd4d746e560>

      def testEnvironment2(self):
  >       omero.processor.ProcessI(self.ctx, sys.executable,
                                   self.props(), self.params())

  test/unit/scriptstest/test_processor.py:137: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  .tox/py310/lib/python3.10/site-packages/omero/processor.py:141: in __init__
      self.make_env()
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

  self = object #0 (::omero::grid::Process)
  {
  }

      def make_env(self):
  >       variables = self.ctx.get("omero.process.env_vars", None)
  E       AttributeError: 'ServerContext' object has no attribute 'get'

  .tox/py310/lib/python3.10/site-packages/omero/processor.py:150: AttributeError