Ejemplo n.º 1
0
 def testInputs(self):
     import logging
     logging.basicConfig(level=10)
     root_client = self.new_client(system=True)
     scripts = root_client.sf.getScriptService()
     id = scripts.uploadScript("/tests/inputs_py/%s.py" % self.uuid(),
                               SENDFILE)
     input = {"a": rint(100)}
     impl = omero.processor.usermode_processor(root_client)
     try:
         process = scripts.runScript(id, input, None)
         cb = omero.scripts.ProcessCallbackI(root_client, process)
         try:
             count = 100
             while cb.block(2000):
                 count -= 1
                 assert count != 0
             rc = process.poll()
             results = process.getResults(0)
             self.output(root_client, results, "stdout")
             self.output(root_client, results, "stderr")
             assert rc is not None
             assert rc.val == 0
         finally:
             cb.close()
     finally:
         impl.cleanup()
Ejemplo n.º 2
0
 def testInputs(self):
     import logging
     logging.basicConfig(level=10)
     root_client = self.new_client(system=True)
     scripts = root_client.sf.getScriptService()
     sendfile = SENDFILE % self.omeropydir()
     id = scripts.uploadScript(
         "/tests/inputs_py/%s.py" % self.uuid(), sendfile)
     input = {"a": rint(100)}
     impl = omero.processor.usermode_processor(root_client)
     try:
         process = scripts.runScript(id, input, None)
         cb = omero.scripts.ProcessCallbackI(root_client, process)
         try:
             count = 100
             while cb.block(2000):
                 count -= 1
                 assert count != 0
             rc = process.poll()
             results = process.getResults(0)
             self.output(root_client, results, "stdout")
             self.output(root_client, results, "stderr")
             assert rc is not None
             assert rc.val == 0
         finally:
             cb.close()
     finally:
         impl.cleanup()
Ejemplo n.º 3
0
 def testInputs(self):
     import logging
     logging.basicConfig(level=10)
     scripts = self.root.getSession().getScriptService()
     sendfile = SENDFILE % self.omeropydir()
     id = scripts.uploadScript("/tests/inputs_py/%s.py" % self.uuid(),
                               sendfile)
     input = {"a": rint(100)}
     impl = omero.processor.usermode_processor(self.root)
     try:
         process = scripts.runScript(id, input, None)
         cb = omero.scripts.ProcessCallbackI(self.root, process)
         try:
             count = 100
             while cb.block(500):
                 count -= 1
                 assert count != 0
             rc = process.poll()
             results = process.getResults(0)
             self.output(results, "stdout")
             self.output(results, "stderr")
             assert rc is not None
             assert rc.val == 0
         finally:
             cb.close()
     finally:
         impl.cleanup()
Ejemplo n.º 4
0
 def testRand(self):
     scripts = self.root.getSession().getScriptService()
     id = scripts.uploadScript("/tests/rand_py/%s.py" % self.uuid(), SENDFILE)
     input = {"x":rlong(3), "y":rlong(3)}
     impl = omero.processor.usermode_processor(self.root)
     try:
         process = scripts.runScript(id, input, None)
         cb = omero.scripts.ProcessCallbackI(self.root, process)
         cb.block(2000) # ms
         cb.close()
         try:
             output = process.getResults(0)
             self.assert_( output["x"].val == 3)
         except KeyError:
             print "Key is not in returned dictionary. Is this a fail?"
     finally:
         impl.cleanup()
Ejemplo n.º 5
0
 def testRand(self):
     scripts = self.root.getSession().getScriptService()
     id = scripts.uploadScript("/tests/rand_py/%s.py" % self.uuid(), SENDFILE)
     input = {"x":rlong(3), "y":rlong(3)}
     impl = omero.processor.usermode_processor(self.root)
     try:
         process = scripts.runScript(id, input, None)
         cb = omero.scripts.ProcessCallbackI(self.root, process)
         cb.block(2000) # ms
         cb.close()
         try:
             output = process.getResults(0)
             self.assert_( output["x"].val == 3)
         except KeyError:
             print "Key is not in returned dictionary. Is this a fail?"
     finally:
         impl.cleanup()
Ejemplo n.º 6
0
 def testRand(self):
     root_client = self.new_client(system=True)
     scripts = root_client.sf.getScriptService()
     id = scripts.uploadScript(
         "/tests/rand_py/%s.py" % self.uuid(), SENDFILE)
     input = {"x": rlong(3), "y": rlong(3)}
     impl = omero.processor.usermode_processor(root_client)
     try:
         process = scripts.runScript(id, input, None)
         cb = omero.scripts.ProcessCallbackI(root_client, process)
         cb.block(2000)  # ms
         cb.close()
         try:
             output = process.getResults(0)
             assert output["x"].val == 3
         except KeyError:
             print("Key is not in returned dictionary. Is this a fail?")
     finally:
         impl.cleanup()