def join(self, others): """Join this workload to a list of others: others = a list of workloads.""" self.addArgs += self.executable.joinCommonArgs # we add ourselves. nothers=[ self ] nothers.extend(others) ncores=0 for wl in nothers: ncores+=wl.used['cores'].value with self.condVar: for wl in nothers: vars= RunVars() vars.add("RUN_DIR", wl.rundir) vars.add("NCORES", "%d"%wl.used['cores'].value) vars.add("NCORES_TOT", "%d"%ncores) vars.add("ARGS", wl.cmd.getArgStr() ) # expand the string now because it contains variables specific # to this joining args=vars.expandStr(self.executable.joinSpecificArgs) self.addArgs += " %s"%args if wl != self: self.joinedTo.append(wl) # add the used values. for self_rsrc in self.used.itervalues(): name=self_rsrc.name if wl.used.has_key(name): self_rsrc.add(wl.used[name])
def expandCmdString(self, additionalRunVars): """Expand an argument string's variables.""" initialArgStr = "%s %s %s" % (self.executable.cmdline, self.cmd.getArgStr(), self.addArgs) vars = RunVars() vars.add("EXECUTABLE_DIR", self.executable.basedir) vars.add("NCORES", "%d" % self.used['cores'].value) vars.add("RUN_DIR", self.rundir) vars.add("ARCH", self.executable.arch) vars.add("PLATFORM", self.executable.platform) vars.add("VERSION", self.executable.version.getStr()) vars.add("CMD_ID", self.cmd.id) vars.addRunVars(self.platform.getRunVars()) if additionalRunVars is not None: vars.addRunVars(additionalRunVars) retstr = vars.expandStr(initialArgStr) return retstr
def join(self, others): """Join this workload to a list of others: others = a list of workloads.""" self.addArgs += self.executable.joinCommonArgs # we add ourselves. nothers = [self] nothers.extend(others) ncores = 0 for wl in nothers: ncores += wl.used['cores'].value with self.condVar: for wl in nothers: vars = RunVars() vars.add("RUN_DIR", wl.rundir) vars.add("NCORES", "%d" % wl.used['cores'].value) vars.add("NCORES_TOT", "%d" % ncores) vars.add("ARGS", wl.cmd.getArgStr()) # expand the string now because it contains variables specific # to this joining args = vars.expandStr(self.executable.joinSpecificArgs) self.addArgs += " %s" % args if wl != self: self.joinedTo.append(wl) # add the used values. for self_rsrc in self.used.itervalues(): name = self_rsrc.name if wl.used.has_key(name): self_rsrc.add(wl.used[name])
def expandCmdString(self, additionalRunVars): """Expand an argument string's variables.""" initialArgStr="%s %s %s"%(self.executable.cmdline, self.cmd.getArgStr(), self.addArgs) vars=RunVars() vars.add("EXECUTABLE_DIR", self.executable.basedir) vars.add("NCORES", "%d"%self.used['cores'].value) vars.add("RUN_DIR", self.rundir) vars.add("ARCH", self.executable.arch) vars.add("PLATFORM", self.executable.platform) vars.add("VERSION", self.executable.version.getStr()) vars.add("CMD_ID", self.cmd.id) vars.addRunVars(self.platform.getRunVars()) if additionalRunVars is not None: vars.addRunVars(additionalRunVars) retstr=vars.expandStr(initialArgStr) return retstr