def __init__(self, folder, name, runConfig): print "RFpost_local::__init__()" self.type = "RFpost_local" self.folder = folder self.instName = name self.runConfig = runConfig #Load paramFile self.__paramFile = AcdOptiFileParser_simple(os.path.join(folder, name, "paramFile.set"), 'rw') if self.__paramFile.dataDict["fileID"] != "Analysis::RFpost_local": raise RFpostException("Got fileID='" + self.__paramFile.dataDict["fileID"] + "'") self.lockdown = DataDict.boolconv(self.__paramFile.dataDict["lockdown"]) self.exportResults = self.__paramFile.dataDict["export"] #Load RFpost solverManager self.localSolver = AcdOptiSolverManager("rfPost.in", os.path.join(folder,name)) if self.lockdown: self.localSolver.lockdown = True #Load the settings if len(self.__paramFile.dataDict.getVals("settings")) == 0: self.__paramFile.dataDict.pushBack("settings", DataDict()) self.__paramFile.dataDict["settings"].pushBack("L","") self.__paramFile.write() self.settings = self.__paramFile.dataDict["settings"]
def __populateTasksList(self): print "RunnerSetup::__populateTasksList()" self.__tasksListStore.clear() for (jobName, job) in self.runner.getJobs(): #Name, command, args, tasks, tasksNode, tasksNuma, ?aprun, jobObject self.__tasksListStore.append([jobName, job["command"], job["commandArgs"],\ int(job["tasks"]), int(job["tasksNode"]), int(job["tasksNuma"]),\ DataDict.boolconv(job["aprun"]), job])
def event_cellRenderer_enabled_toggled(self, cellrenderertoggle, path, data=None): print "SolverSetup::event_cellRenderer_enabled_toggled(), path='" + str(path) + "', row= '" + self.__rowStringer(self.__dynamicTableTree[path]) + "'" data = self.__dynamicTableTree[path][-1] if DataDict.boolconv(data["enabled"]): data.setValSingle("enabled", "False") else: data.setValSingle("enabled", "True") self.__dynamicTableTree[path][3] = not self.__dynamicTableTree[path][3]
def __updateDynamicTable_recursive(self,metaSetup,parentIter): """ Method that recursively calls itself whenever it encounters a "dict" entry in the metaSetupFile. """ print "SolverSetup::__updateDynamicTable_recursive()" for (key,val) in metaSetup: #print (key,val) type = val["type"] if type == "dict": iter = self.__dynamicTableTree.append(parentIter,\ [key, type, "", DataDict.boolconv(val["enabled"]), not DataDict.boolconv(val["must"]), False, val]) self.__updateDynamicTable_recursive(val["children"], iter) #elif type=="fnameNoEx" or type=="fnameEx" or type=="string": else: iter = self.__dynamicTableTree.append(parentIter,\ [key, type, val["value"], DataDict.boolconv(val["enabled"]), not DataDict.boolconv(val["must"]), True, val]) print "SolverSetup::__updateDynamicTable_recursive() - return"
def __init__(self, folder, name, runConfig): print "FileList::__init__()" self.type = "FileList" self.folder = folder self.instName = name self.runConfig = runConfig self.__paramFile = AcdOptiFileParser_simple(os.path.join(folder, name), "rw") if self.__paramFile.dataDict["fileID"] != "Analysis::FileList": raise FileListException("Got fileID='" + self.__paramFile.dataDict["fileID"] + "'") self.lockdown = DataDict.boolconv(self.__paramFile.dataDict["lockdown"]) self.exportResults = self.__paramFile.dataDict["export"]
def __init__(self, folder, name, runConfig): print "GroupVelocity::__init__()" self.type = "GroupVelocity" self.folder = folder self.instName = name self.runConfig = runConfig self.__paramFile = AcdOptiFileParser_simple(os.path.join(folder, name), 'rw') if self.__paramFile.dataDict["fileID"] != "Analysis::GroupVelocity": raise GroupVelocityException("Got fileID='" + self.__paramFile.dataDict["fileID"] + "'") self.lockdown = DataDict.boolconv(self.__paramFile.dataDict["lockdown"]) self.exportResults = self.__paramFile.dataDict["export"] self.settings = self.__paramFile.dataDict["settings"]
def __init__(self, folder, name, runConfig): print "ModeFileRecalc::__init__()" self.type = "ModeFileRecalc" self.folder = folder self.instName = name self.runConfig = runConfig #Load paramFile self.__paramFile = AcdOptiFileParser_simple(os.path.join(folder, name, "paramFile.set"), 'rw') if self.__paramFile.dataDict["fileID"] != "Analysis::ModeFileRecalc": raise ModeFileRecalcException("Got fileID='" + self.__paramFile.dataDict["fileID"] + "'") self.lockdown = DataDict.boolconv(self.__paramFile.dataDict["lockdown"]) self.exportResults = self.__paramFile.dataDict["export"] #Load the settings self.settings = self.__paramFile.dataDict["settings"]
def event_dynamicTable_cursorChanged(self, widget, data=None): print "SolverSetup::event_dynamicTable_cursorChanged()" #Get the currently selected row (path,column) = self.__dynamicTable.get_cursor() if not path: #Nothing selected... self.__copyButton.set_sensitive(False) self.__delButton.set_sensitive(False) return row = self.__dynamicTableTree[path] if DataDict.boolconv(row[-1]["single"]): self.__copyButton.set_sensitive(False) self.__delButton.set_sensitive(False) else: self.__copyButton.set_sensitive(True) #Is it alone? Can't delete the last instance... #Find the parent "children" dict parent = None if len(path) == 1: #Top-level parent = self.solverSetup.metaSetup parentChild = parent#["options"] else: parentRow = self.__dynamicTableTree[path[:-1]] parent = parentRow[-1] parentChild = parent["children"] #Search for siblings with same name findings = 0 for (k,v) in parentChild: if k == row[0]: findings += 1 if findings > 1: self.__delButton.set_sensitive(True) else: self.__delButton.set_sensitive(False)
def __init__(self, folder, collection): print "Scan2D_Tune::__init__()" super(Scan2D_Tune,self).__init__(folder,collection,"ParameterScan::Scan2D_Tune") self.scanParameter1_name = self._paramFile.dataDict["scanParameter1_name"] self.scanParameter1_min = float(self._paramFile.dataDict["scanParameter1_min"]) self.scanParameter1_max = float(self._paramFile.dataDict["scanParameter1_max"]) self.scanParameter1_num = int(self._paramFile.dataDict["scanParameter1_num"]) self.scanParameter2_name = self._paramFile.dataDict["scanParameter2_name"] self.scanParameter2_min = float(self._paramFile.dataDict["scanParameter2_min"]) self.scanParameter2_max = float(self._paramFile.dataDict["scanParameter2_max"]) self.scanParameter2_num = int(self._paramFile.dataDict["scanParameter2_num"]) self.tune_parameter = self._paramFile.dataDict["tune_parameter"] self.tune_anaVariable = self._paramFile.dataDict["tune_anaVariable"] self.tune_targetValue = float(self._paramFile.dataDict["tune_targetValue"]) self.tune_initialPoints = [] for (k,v) in self._paramFile.dataDict["tune_initialPoints"]: self.tune_initialPoints.append(k) self.tune_model = [] try: tune_ipModelDict = self._paramFile.dataDict["tune_ipModelDict"] self.tune_useModelPoints = DataDict.boolconv(self._paramFile.dataDict["tune_useModelPoints"]) except AcdOptiException_dataDict_getValsSingle: print "Scan2D_Tune::__init__(): Adding tune_ipModelDict and tune_useModelPoints to paramFile" self._paramFile.dataDict.pushBack("tune_ipModelDict", DataDict()) self._paramFile.dataDict.pushBack("tune_useModelPoints", "False") self._paramFile.write() tune_ipModelDict = DataDict() self.tune_useModelPoints = False i = 0 for (k,v) in tune_ipModelDict: assert k == str(i) self.tune_model.append(float(v)) i += 1 #Initialize slave scan collection in same folder self.slaveScanCollection = ParameterScanCollection(folder, collection,self)
def __init__(self, folder, name, runConfig): print "Omega3P_modeInfo::__init__()" self.type = "Omega3P_modeInfo" self.folder = folder self.instName = name self.runConfig = runConfig self.__paramFile = AcdOptiFileParser_simple(os.path.join(folder, name), 'rw') if self.__paramFile.dataDict["fileID"] != "Analysis::Omega3P_modeInfo": raise Omega3P_modeInfo_exception("Got fileID='" + self.__paramFile.dataDict["fileID"] + "'") self.lockdown = DataDict.boolconv(self.__paramFile.dataDict["lockdown"]) self.exportResults = self.__paramFile.dataDict["export"] if "modes" in self.exportResults: #Convert to new format print "Converting to new format..." modes = self.exportResults["modes"].copy() self.exportResults.clear() for (k,v) in modes: self.exportResults.pushBack(k,v) self.write()
def __init__(self,folder,collection, typ): from ParameterScanCollection import ParameterScanCollection assert typ in ParameterScanCollection.parameterScanTypes or "ParameterScan::"+ typ in ParameterScanCollection.parameterScanTypes self.type = typ self.folder = folder self.scanCollection = collection #Construct the instance name from folder instName = folder if instName[-1] == "/": instName = instName[0:-1] self.instName = instName = os.path.split(instName)[1] #Load paramFile.set self._paramFile = AcdOptiFileParser_simple(os.path.join(folder, "paramFile_scan.set"), 'rw') if self._paramFile.dataDict["fileID"] != self.type: raise ParameterScanInterfaceException_init("Got fileID='" + self._paramFile.dataDict["fileID"] + "'") if self._paramFile.dataDict.getValSingle("instName") != self.instName: raise ParameterScanInterfaceException_init("instName doesn't match folder name") self.lockdown = DataDict.boolconv(self._paramFile.dataDict["lockdown"]) baseGeomInstance_name = self._paramFile.dataDict["baseGeomInstance_name"] if baseGeomInstance_name == "": self.baseGeomInstance = None assert len(self._paramFile.dataDict["slaveGeoms"]) == 0 assert self.lockdown == False else: self.baseGeomInstance = self.getProject().geomCollection.geomInstances[baseGeomInstance_name] self.slaveGeoms = {} for (geomName, nothingOfInterest) in self._paramFile.dataDict["slaveGeoms"]: #Mutal referencing self.slaveGeoms[geomName] = self.getProject().geomCollection.geomInstances[geomName] self.slaveGeoms[geomName].scanInstances.append(self) if len(self.slaveGeoms) > 0: assert self.lockdown == True
def __init__(self,frameManager,runner): print "RunnerSetup_Hopper::__init__()" InfoFrameComponent.__init__(self, frameManager) self.runner = runner self.baseWidget = gtk.VBox() #Torque stuff: tqm = self.runner.getTorqueMeta() print tqm self.baseWidget.pack_start(gtk.Label("Torque information:"), expand=False,padding=5) self.__torqueTable = gtk.Table(4,2,False) self.__queueCombo = gtk.combo_box_entry_new_text() #self.__queueCombo.append_text(tqm["queue"]) self.__queueCombo.append_text("regular") self.__queueCombo.append_text("debug") if tqm["queue"] == "regular": self.__queueCombo.set_active(0) else: self.__queueCombo.set_active(1) self.__torqueTable.attach(gtk.Label("Queue:"), 0,1,0,1, xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) self.__torqueTable.attach(self.__queueCombo , 1,2,0,1, xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) self.__walltimeEdit = gtk.Entry() if self.__checkWalltime(tqm["walltime"]): self.__walltimeEdit.set_text(tqm["walltime"]) else: self.__walltimeEdit.set_text("hh:mm:ss") self.__torqueTable.attach(gtk.Label("Walltime:"), 0,1,1,2,xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) self.__torqueTable.attach(self.__walltimeEdit , 1,2,1,2,xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) self.__repoEdit = gtk.Entry() self.__repoEdit.set_text(tqm["repo"]) self.__torqueTable.attach(gtk.Label("Repository:"), 0,1,2,3,xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) self.__torqueTable.attach(self.__repoEdit , 1,2,2,3,xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) self.__importvarsCheck = gtk.CheckButton() if DataDict.boolconv(tqm["importVars"]): self.__importvarsCheck.set_active(True) else: self.__importvarsCheck.set_active(False) self.__torqueTable.attach(gtk.Label("Import variables:"), 0,1,3,4,xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) self.__torqueTable.attach(self.__importvarsCheck , 1,2,3,4,xoptions=gtk.FILL|gtk.EXPAND, yoptions=gtk.FILL) self.baseWidget.pack_start(self.__torqueTable, expand=False) self.baseWidget.pack_start(gtk.HSeparator(), expand=False,padding=10) #Commands stuff #Name, command, commandArgs, tasks, tasksNode, tasksNuma, ?aprun, job self.__tasksListStore = gtk.ListStore(str, str, str, int, int, int, bool, object) self.__tasksList = gtk.TreeView(self.__tasksListStore) self.__tasksRenderers = [] self.__tasksColumns = [] self.__tasksRenderers.append(gtk.CellRendererText()) self.__tasksRenderers[-1].set_property("editable", True) self.__tasksRenderers[-1].connect('edited', self.event_tasksList_textEdit, "name") self.__tasksColumns.append(gtk.TreeViewColumn("Name", self.__tasksRenderers[-1], text=0)) self.__tasksList.append_column(self.__tasksColumns[-1]) self.__tasksRenderers.append(gtk.CellRendererText()) self.__tasksRenderers[-1].set_property("editable", True) self.__tasksRenderers[-1].connect('edited', self.event_tasksList_textEdit, "command") self.__tasksColumns.append(gtk.TreeViewColumn("Command", self.__tasksRenderers[-1], text=1)) self.__tasksColumns[-1].set_expand(True) self.__tasksList.append_column(self.__tasksColumns[-1]) self.__tasksRenderers.append(gtk.CellRendererText()) self.__tasksRenderers[-1].connect('edited', self.event_tasksList_textEdit, "commandArgs") self.__tasksColumns.append(gtk.TreeViewColumn("Command arguments", self.__tasksRenderers[-1], text=2, visible=6, editable=6)) self.__tasksList.append_column(self.__tasksColumns[-1]) self.__tasksRenderers.append(gtk.CellRendererText()) self.__tasksRenderers[-1].connect('edited', self.event_tasksList_textEdit, "tasks") self.__tasksColumns.append(gtk.TreeViewColumn("# Tasks", self.__tasksRenderers[-1], text=3, visible=6, editable=6)) self.__tasksList.append_column(self.__tasksColumns[-1]) self.__tasksRenderers.append(gtk.CellRendererText()) self.__tasksRenderers[-1].connect('edited', self.event_tasksList_textEdit, "tasksNode") self.__tasksColumns.append(gtk.TreeViewColumn("(# tasks pr. node)", self.__tasksRenderers[-1], text=4, visible=6, editable=6)) self.__tasksList.append_column(self.__tasksColumns[-1]) self.__tasksRenderers.append(gtk.CellRendererText()) self.__tasksRenderers[-1].connect('edited', self.event_tasksList_textEdit, "tasksNuma") self.__tasksColumns.append(gtk.TreeViewColumn("(# tasks pr. NUMAnode)", self.__tasksRenderers[-1], text=5, visible=6, editable=6)) self.__tasksList.append_column(self.__tasksColumns[-1]) self.__tasksRenderers.append(gtk.CellRendererToggle()) self.__tasksRenderers[-1].connect("toggled", self.event_tasksList_aprunToggled, None) self.__tasksColumns.append(gtk.TreeViewColumn("Use aprun", self.__tasksRenderers[-1], active=6)) self.__tasksList.append_column(self.__tasksColumns[-1]) self.__scrollWindow = gtk.ScrolledWindow() self.__scrollWindow.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) self.__scrollWindow.add(self.__tasksList) self.baseWidget.pack_start(self.__scrollWindow, expand=True) self.__populateTasksList() self.__tasksList.connect("cursor-changed", self.event_tasksList_cursorChanged, None) self.__tasksButtonsBox = gtk.HBox() self.__tasksMoveUpButton = gtk.Button("Move entry up") self.__tasksButtonsBox.pack_start(self.__tasksMoveUpButton) self.__tasksMoveUpButton.connect("clicked", self.event_button_moveUp, None) self.__tasksAddButton = gtk.Button("_Add new task") self.__tasksButtonsBox.pack_start(self.__tasksAddButton) self.__tasksAddButton.connect("clicked", self.event_button_add, None) self.__tasksDelButton = gtk.Button("_Delete task") self.__tasksButtonsBox.pack_start(self.__tasksDelButton) self.__tasksDelButton.connect("clicked", self.event_button_del, None) self.__tasksMoveDownButton = gtk.Button("Move entry down") self.__tasksButtonsBox.pack_start(self.__tasksMoveDownButton) self.__tasksMoveDownButton.connect("clicked", self.event_button_moveDown, None) self.event_tasksList_cursorChanged(self.__tasksList, None) self.baseWidget.pack_start(self.__tasksButtonsBox, expand=False) self.baseWidget.pack_start(gtk.HSeparator(), expand=False,padding=10) self.__closeButton = gtk.Button("_Close") self.__closeButton.connect("clicked", self.event_button_close, None) self.baseWidget.pack_start(self.__closeButton, expand=False) if self.runner.lockdown: self.__queueCombo.set_sensitive(False) self.__walltimeEdit.set_sensitive(False) self.__repoEdit.set_sensitive(False) self.__importvarsCheck.set_sensitive(False) self.__tasksList.set_sensitive(False) self.__tasksAddButton.set_sensitive(False) self.__tasksDelButton.set_sensitive(False) self.__tasksMoveUpButton.set_sensitive(False) self.__tasksMoveDownButton.set_sensitive(False) self.baseWidget.show_all()
def event_tasksList_aprunToggled(self,cellrenderertoggle, path, data=None): print "SolverSetup::event_cellRenderer_enabled_toggled(), path='" + str(path) + "'" job = self.__tasksListStore[path][-1] self.__tasksListStore[path][6] = not self.__tasksListStore[path][6] job.setValSingle("aprun", str(not DataDict.boolconv(job["aprun"])))