def getUserData(self):
		username = apParam.getUsername()
		userq = leginon.leginondata.UserData()
		userq['username'] = username
		userdatas = userq.query(results=1)
		if not userdatas:
			return None
		return userdatas[0]
 def getClusterJobData(self):
     if self.clusterjobdata is not None:
         return self.clusterjobdata
     if not 'commit' in self.params or self.params['commit'] is False:
         return None
     pathq = appiondata.ApPathData(
         path=os.path.abspath(self.params['rundir']))
     clustq = appiondata.ApAppionJobData()
     clustq['path'] = pathq
     clustq['jobtype'] = self.functionname.lower()
     clustdatas = clustq.query()
     if not clustdatas:
         ### insert a cluster job
         clustq['name'] = self.params['runname'] + ".appionsub.job"
         clustq['clusterpath'] = pathq
         clustq['user'] = apParam.getUsername()
         clustq['cluster'] = apParam.getHostname()
         clustq['status'] = "R"
         clustq['session'] = self.getSessionData()
         ### need a proper way to create a jobtype
         clustq['jobtype'] = self.params['jobtype']
         if not clustq['jobtype']:
             clustq['jobtype'] = self.functionname.lower()
         clustq.insert()
         self.clusterjobdata = clustq
         return clustq
     elif len(clustdatas) == 1:
         ### we have an entry
         ### we need to say that we are running
         apWebScript.setJobToRun(clustdatas[0].dbid)
         self.clusterjobdata = clustdatas[0]
         return clustdatas[0]
     else:
         ### special case: more than one job with given path
         apDisplay.printWarning("More than one cluster job has this path")
         self.clusterjobdata = clustdatas[0]
         return clustdatas[0]
	def getClusterJobData(self):
		if self.clusterjobdata is not None:
			return self.clusterjobdata
		if not 'commit' in self.params or self.params['commit'] is False:
			return None
		pathq = appiondata.ApPathData(path=os.path.abspath(self.params['rundir']))
		clustq = appiondata.ApAppionJobData()
		clustq['path'] = pathq
		clustq['jobtype'] = self.functionname.lower()
		clustdatas = clustq.query()
		if not clustdatas:
			### insert a cluster job
			clustq['name'] = self.params['runname']+".appionsub.job"
			clustq['clusterpath'] = pathq
			clustq['user'] = apParam.getUsername()
			clustq['cluster'] = apParam.getHostname()
			clustq['status'] = "R"
			clustq['session'] = self.getSessionData()
			### need a proper way to create a jobtype
			clustq['jobtype']=self.params['jobtype']
			if not clustq['jobtype']:
				clustq['jobtype'] = self.functionname.lower()
			clustq.insert()
			self.clusterjobdata = clustq
			return clustq
		elif len(clustdatas) == 1:
			### we have an entry
			### we need to say that we are running
			apWebScript.setJobToRun(clustdatas[0].dbid)
			self.clusterjobdata = clustdatas[0]
			return clustdatas[0]
		else:
			### special case: more than one job with given path
			apDisplay.printWarning("More than one cluster job has this path")
			self.clusterjobdata = clustdatas[0]
			return clustdatas[0]