Ejemplo n.º 1
0
    def run(self, args):
        if not os.path.exists(args.file):
            self.ctx.die(670, "No such file: %s" % args.file)
        else:
            client = self.ctx.conn(args)
            store = SessionsStore()
            srv, usr, uuid = store.get_current()
            props = store.get(srv, usr, uuid)

            from omero.scripts import parse_file
            from omero.util.temp_files import create_path
            path = create_path()
            text = """
omero.host=%(omero.host)s
omero.user=%(omero.sess)s
omero.pass=%(omero.sess)s
            """
            path.write_text(text % props)

            params = parse_file(args.file)
            m = self._parse_inputs(args, params)
            for k, v in m.items():
                if v is not None:
                    client.setInput(k, v)

            p = self.ctx.popen([sys.executable, args.file], stdout=sys.stdout,
                               stderr=sys.stderr, ICE_CONFIG=str(path))
            p.wait()
            if p.poll() != 0:
                self.ctx.die(p.poll(), "Execution failed.")
Ejemplo n.º 2
0
    def run(self, args):
        if not os.path.exists(args.file):
            self.ctx.die(670, "No such file: %s" % args.file)
        else:
            client = self.ctx.conn(args)
            store = SessionsStore()
            srv, usr, uuid, port = store.get_current()
            props = store.get(srv, usr, uuid)

            from omero.scripts import parse_file
            from omero.util.temp_files import create_path
            path = create_path()
            text = """
omero.host=%(omero.host)s
omero.user=%(omero.sess)s
omero.pass=%(omero.sess)s
            """
            path.write_text(text % props)

            params = parse_file(args.file)
            m = self._parse_inputs(args, params)
            for k, v in list(m.items()):
                if v is not None:
                    client.setInput(k, v)

            p = self.ctx.popen([sys.executable, args.file],
                               stdout=sys.stdout,
                               stderr=sys.stderr,
                               ICE_CONFIG=str(path))
            p.wait()
            if p.poll() != 0:
                self.ctx.die(p.poll(), "Execution failed.")
Ejemplo n.º 3
0
 def testValidateRoiMovieCall(self):
     script = SCRIPTS / "figure_scripts" / "Movie_ROI_Figure.py"
     params = parse_file(str(script))
     inputs = {
         "Merged_Colours": wrap(['Red', 'Green']),
         "Image_Labels": wrap("Datasets"),
         "Data_Type": wrap("Image"),
         "IDs": wrap([long(1)])
     }
     errors = validate_inputs(params, inputs)
     assert "" == errors, errors
Ejemplo n.º 4
0
 def testValidateRoiMovieCall(self):
     script = SCRIPTS / "figure_scripts" / "Movie_ROI_Figure.py"
     params = parse_file(str(script))
     inputs = {
         "Merged_Colours": wrap(['Red', 'Green']),
         "Image_Labels": wrap("Datasets"),
         "Data_Type": wrap("Image"),
         "IDs": wrap([long(1)])
     }
     errors = validate_inputs(params, inputs)
     assert "" == errors, errors
Ejemplo n.º 5
0
 def testParseAllOfficialScripts(self):
     for script in SCRIPTS.walk("*.py"):
         try:
             parse_file(str(script))
         except Exception, e:
             assert False, "%s\n%s" % (script, e)
Ejemplo n.º 6
0
 def testParseAllOfficialScripts(self):
     for script in SCRIPTS.walk("*.py"):
         try:
             parse_file(str(script))
         except Exception, e:
             assert False, "%s\n%s" % (script, e)
Ejemplo n.º 7
0
 def test_parse_all_official_scripts(self):
     for script in SCRIPTS.walk("*.py"):
         try:
             parse_file(str(script))
         except Exception as e:
             assert False, "%s\n%s" % (script, e)