def get_initial_run_info(resIdx, attrs, eInfo, ptds): """Parses the run data file and addes the information to the Execution object, exe.""" runMachineArg = eInfo.machineName # expect only one execution resource in resIdx [exe] = resIdx.findResourcesByType("execution") (runMachine, runOS, exe, numberOfProcesses, threadsPerProcess)\ = getInitialAVs(resIdx, attrs, exe, runMachineArg, ptds) envNewName = ptds.getNewResourceName("env") env = Resource(envNewName, "environment") resIdx.addResource(env) if attrs.getCurrent()[0] != "RunDataEnd": (exe) = getSubmission(resIdx, attrs, exe, ptds) if attrs.getCurrent()[0] != "RunDataEnd": (exe) = getFilesystems(resIdx, attrs, exe, ptds) if attrs.getCurrent()[0] != "RunDataEnd": (env) = getLibraries(resIdx, attrs, env, exe) #env.dump(recurse=True) if attrs.getCurrent()[0] != "RunDataEnd": (exe) = getInputDecks(resIdx, attrs, exe, ptds) # expect only one build resource in resIdx [build] = resIdx.findResourcesByType("build") # check to see if we figured out how many processes there were if numberOfProcesses != -1: # yes, so create resource entries for all processes and threads i = 0 while i < int(numberOfProcesses): process = Resource( exe.name + Resource.resDelim + "Process-" + str(i), "execution" + Resource.resDelim + "process") resIdx.addResource(process) process.addAttribute("environment", env.name, "resource") process.addAttribute("build", build.name, "resource") process.addAttribute("OS name", runOS.name, "resource") if runMachine: process.addAttribute("machine name", runMachine.name, "resource") j = 0 while j < int(threadsPerProcess): thread = Resource( process.name + Resource.resDelim + "Thread-" + str(j), "execution" + Resource.resDelim + "process" + Resource.resDelim + "thread") resIdx.addResource(thread) j += 1 i += 1 # couldn't figure out number of processes, so link up resources with # the execution resource else: exe.addAttribute("environment", env.name, "resource") exe.addAttribute("build", build.name, "resource") exe.addAttribute("OS name", runOS.name, "resource") if runMachine: exe.addAttribute("machine name", runMachine.name, "resource")
def get_initial_run_info(resIdx, attrs, eInfo, ptds): """Parses the run data file and addes the information to the Execution object, exe.""" runMachineArg = eInfo.machineName # expect only one execution resource in resIdx [exe] = resIdx.findResourcesByType("execution") (runMachine, runOS, exe, numberOfProcesses, threadsPerProcess) = getInitialAVs( resIdx, attrs, exe, runMachineArg, ptds ) envNewName = ptds.getNewResourceName("env") env = Resource(envNewName, "environment") resIdx.addResource(env) if attrs.getCurrent()[0] != "RunDataEnd": (exe) = getSubmission(resIdx, attrs, exe, ptds) if attrs.getCurrent()[0] != "RunDataEnd": (exe) = getFilesystems(resIdx, attrs, exe, ptds) if attrs.getCurrent()[0] != "RunDataEnd": (env) = getLibraries(resIdx, attrs, env, exe) # env.dump(recurse=True) if attrs.getCurrent()[0] != "RunDataEnd": (exe) = getInputDecks(resIdx, attrs, exe, ptds) # expect only one build resource in resIdx [build] = resIdx.findResourcesByType("build") # check to see if we figured out how many processes there were if numberOfProcesses != -1: # yes, so create resource entries for all processes and threads i = 0 while i < int(numberOfProcesses): process = Resource( exe.name + Resource.resDelim + "Process-" + str(i), "execution" + Resource.resDelim + "process" ) resIdx.addResource(process) process.addAttribute("environment", env.name, "resource") process.addAttribute("build", build.name, "resource") process.addAttribute("OS name", runOS.name, "resource") if runMachine: process.addAttribute("machine name", runMachine.name, "resource") j = 0 while j < int(threadsPerProcess): thread = Resource( process.name + Resource.resDelim + "Thread-" + str(j), "execution" + Resource.resDelim + "process" + Resource.resDelim + "thread", ) resIdx.addResource(thread) j += 1 i += 1 # couldn't figure out number of processes, so link up resources with # the execution resource else: exe.addAttribute("environment", env.name, "resource") exe.addAttribute("build", build.name, "resource") exe.addAttribute("OS name", runOS.name, "resource") if runMachine: exe.addAttribute("machine name", runMachine.name, "resource")
def getInitialAVs(resIdx, attrs, exeName, ptds): """ Takes attrs, which is a list of name, value pairs, and builds a build Resource object and Execution object """ executableAVs = [] buildAVs = [] buildOSAVs = [] AppName = "" BuildMachType = "" BuildMachine = "" BuildOSName = "" BuildOSVersion = "" BuildOSType = "" # regular expressions for parsing for name, value, type in attrs: if name == "BuildDataBegin": pass elif name == "BuildDataEnd": break # Get executable specific data elif name == "ApplicationName": AppName = value elif name == "ApplicationExeTrialName" or name == "ApplicationExeUserComment": AppTrialName = value elif name.startswith("Application"): if name == "ApplicationLanguages": value = fixListFormat(value) executableAVs.append(("Languages", value, "string")) elif name == "ApplicationParadigms": value = fixListFormat(value) executableAVs.append(("Concurrency", value, "string")) elif name == "ApplicationExeName": executableAVs.append(("Executable Name", value, "string")) elif name == "ApplicationExeSize": executableAVs.append(("Executable Size", value, "string")) elif name == "ApplicationExePerms": executableAVs.append(("Executable Permissions", value, "string")) elif name == "ApplicationExeUID": executableAVs.append(("Executable UID", value, "string")) elif name == "ApplicationExeGID": executableAVs.append(("Executable GID", value, "string")) elif name == "ApplicationExeTimestamp": executableAVs.append(("Executable Timestamp", value, "string")) elif name == "ApplicationExeUsername": executableAVs.append(("Username", value, "string")) # get Build specific data elif name.startswith("Build") and not (name.find("BuildOS") >= 0): if name == "BuildEnv": BuildEnv = [] # a list of attr value pairs # where attr = "BuildEnv"+ (enviroment variable name) # and value is the environment variable's value # e.g. for PATH=/usr/bin:/usr/local/bin # attr = BuildEnvPATH # value = /usr/bin:/usr/local/bin BuildEnv = StringToList("Env_", "@@@", value) for (n, v) in BuildEnv: if v != "": buildAVs.append((n, v, "string")) else: if name == "BuildNode" or name == "BuildMachine": BuildMachine = value if name == "BuildNode": BuildMachType = "node" buildAVs.append(("Node Name", value, "string")) elif name == "BuildMachine": BuildMachType = "machine" buildAVs.append(("Machine Name", value, "string")) if name == "BuildDateTime": buildAVs.append(("DateTime", value, "string")) # get Build operating system specific data elif name.startswith("BuildOS"): if name == "BuildOSName": BuildOSName = value elif name == "BuildOSReleaseVersion": BuildOSVersion = value elif name == "BuildOSReleaseType": BuildOSType = value if exeName == "" or exeName == None: raise PTexception("missing execution name in Build.getInitialAVs") exeNewName = ptds.getNewResourceName(exeName) # ATTR CHANGE TODO # executableAVs should be attrs of build, not execution exe = Execution(exeNewName, executableAVs) resIdx.addResource(exe) newBuildName = ptds.getNewResourceName("build") build = Resource(newBuildName, "build", buildAVs) resIdx.addResource(build) if BuildMachine == "" or BuildMachine == None: raise PTexception("missing build machine name in build data file for " " execution:%s" % exeName) if BuildMachType == "node": fullname, type = getMachineName(ptds, BuildMachine, BuildMachType) # print fullname buildMachine = Resource(fullname, type) else: # machine fullname, type = getMachineName(ptds, BuildMachine, BuildMachType) buildMachine = Resource(fullname, type) if BuildOSName == "" or BuildOSName == None: raise PTexception("missing build operating system name for execution" "execution:%s" % exeName) if BuildOSVersion == "" or BuildOSVersion == None or BuildOSType == "" or BuildOSType == None: raise PTexception("missing build operating system details for execution" "execution:%s" % exeName) buildOSNewName = ptds.getNewResourceName(BuildOSName + " " + BuildOSVersion + " " + BuildOSType) buildOS = Resource(buildOSNewName, "operatingSystem", buildOSAVs) resIdx.addResources([buildOS, buildMachine]) build.addAttribute("Node Name", buildMachine.name, "resource") build.addAttribute("OS Name", buildOS.name, "resource") return (build, exe)
def getInitialAVs(resIdx, attrs, exeName, ptds): """ Takes attrs, which is a list of name, value pairs, and builds a build Resource object and Execution object """ executableAVs = [] buildAVs = [] buildOSAVs = [] AppName = "" BuildMachType = "" BuildMachine = "" BuildOSName = "" BuildOSVersion = "" BuildOSType = "" # regular expressions for parsing for name,value,type in attrs: if name == "BuildDataBegin": pass elif name == "BuildDataEnd": break #Get executable specific data elif name == "ApplicationName": AppName = value elif name == "ApplicationExeTrialName" or \ name == "ApplicationExeUserComment": AppTrialName = value elif name.startswith("Application"): if name == "ApplicationLanguages": value = fixListFormat(value) executableAVs.append(("Languages", value, "string")) elif name == "ApplicationParadigms": value = fixListFormat(value) executableAVs.append(("Concurrency", value, "string")) elif name == "ApplicationExeName": executableAVs.append(("Executable Name", value, "string")) elif name == "ApplicationExeSize": executableAVs.append(("Executable Size", value, "string")) elif name == "ApplicationExePerms": executableAVs.append(("Executable Permissions", value, "string")) elif name == "ApplicationExeUID": executableAVs.append(("Executable UID", value, "string")) elif name == "ApplicationExeGID": executableAVs.append(("Executable GID", value, "string")) elif name == "ApplicationExeTimestamp": executableAVs.append(("Executable Timestamp", value, "string")) elif name == "ApplicationExeUsername": executableAVs.append(("Username", value, "string")) # get Build specific data elif name.startswith("Build") and not (name.find("BuildOS") >= 0): if name == "BuildEnv": BuildEnv = [] # a list of attr value pairs #where attr = "BuildEnv"+ (enviroment variable name) #and value is the environment variable's value #e.g. for PATH=/usr/bin:/usr/local/bin # attr = BuildEnvPATH # value = /usr/bin:/usr/local/bin BuildEnv = StringToList("Env_","@@@", value) for (n,v) in BuildEnv: if(v != ""): buildAVs.append((n,v,"string")) else: if name == "BuildNode" or name == "BuildMachine": BuildMachine = value if name == "BuildNode": BuildMachType = 'node' buildAVs.append(("Node Name",value,"string")) elif name == "BuildMachine": BuildMachType = 'machine' buildAVs.append(("Machine Name",value,"string")) if name == "BuildDateTime": buildAVs.append(("DateTime",value,"string")) #get Build operating system specific data elif name.startswith("BuildOS"): if name == "BuildOSName": BuildOSName = value elif name == "BuildOSReleaseVersion": BuildOSVersion = value elif name == "BuildOSReleaseType": BuildOSType = value if exeName == "" or exeName == None: raise PTexception("missing execution name in Build.getInitialAVs") exeNewName = ptds.getNewResourceName(exeName) # ATTR CHANGE TODO # executableAVs should be attrs of build, not execution exe = Execution(exeNewName, executableAVs) resIdx.addResource(exe) newBuildName = ptds.getNewResourceName("build") build = Resource(newBuildName, "build", buildAVs) resIdx.addResource(build) if BuildMachine == "" or BuildMachine == None: raise PTexception("missing build machine name in build data file for " " execution:%s" % exeName) if BuildMachType == "node": fullname,type = getMachineName(ptds, BuildMachine, BuildMachType) #print fullname buildMachine = Resource(fullname,type) else: # machine fullname,type = getMachineName(ptds, BuildMachine, BuildMachType) buildMachine = Resource(fullname,type) if BuildOSName == "" or BuildOSName == None: raise PTexception("missing build operating system name for execution"\ "execution:%s" % exeName) if BuildOSVersion == "" or BuildOSVersion == None or \ BuildOSType == "" or BuildOSType == None: raise PTexception("missing build operating system details for execution"\ "execution:%s" % exeName) buildOSNewName = ptds.getNewResourceName(BuildOSName+" "+BuildOSVersion+\ " "+BuildOSType) buildOS = Resource(buildOSNewName, "operatingSystem", buildOSAVs) resIdx.addResources([buildOS,buildMachine]) build.addAttribute("Node Name", buildMachine.name, "resource") build.addAttribute("OS Name", buildOS.name, "resource") return(build,exe)