Пример #1
0
    def run(self):
        try:
            script = self.getParam("--script")
            fromStep = self.getIntParam("--range", 0)
            toStep = self.getIntParam("--range", 1)
            project = XmippProject()
            project.load()
            # Create protocol instance from script and setup database
            protocol = project.getProtocolFromModule(script)
            protocol.runSetup(isMainLoop=False)
            self.db = protocol.Db
            # All nodes retrieve parallel steps to work on
            self.steps = self.db.getStepsRange(fromStep, toStep)

            comm = MPI.COMM_WORLD
            self.rank = comm.Get_rank()
            self.size = comm.Get_size()

            if self.rank:
                self.runWorker(comm)
            else:
                self.runMaster(comm)

            # comm.Disconnect()

        except Exception, e:
            if hasattr(self, "db"):
                printLog("Stopping MPI process because of error %s" % e, self.db.Log, out=True, err=True, isError=True)
                self.db.updateRunState(SqliteDb.RUN_FAILED)
            else:
                print "Stopping MPI process because of error %s" % e
            exit(1)
Пример #2
0
def validatorValidRun(var):
    ''' Check if the variable value is a valid posible run '''
    project = XmippProject()
    project.load()
    runList = project.getFinishedRunList(var.getTagValues('run'))
    run = var.getTkValue()
    if not run in runList:
        err = "Run <%s> is not valid" % run
    else:
        err = None
    return err