示例#1
0
 def registerTaskStart(self, tasknumber=None):
   key = "TASK_START" 
   if tasknumber is None:
     tasknumber = session.query(func.max(CatalogEventLog.c.taskNumber)).one()[0]
     if tasknumber is None:
       tasknumber = 1
   else:
     pass
   self._tasknumber = tasknumber
   value = "Task started"
   self.persist(key, value, self._jobdescription)
示例#2
0
 def __init__(self, jobid=None):
   self._jobid = None
   self._states = {}
   self._conn = engine.connect()
   if jobid is None:
     jobid = session.query(func.max(JobStateLog.c.jobid)).one()[0]
     if jobid is None:
       self._jobid = JobId(1)
     else:
       self._jobid = JobId(jobid + 1)
   else:
     if isinstance(jobid, JobId):
       self._jobid = jobid
     elif isinstance(jobid, int):
       self._jobid = JobId(jobid)
     else:
       raise Exception("The jobid is not an int or JobId class")
     statearr = session.query(JobStateLog).filter("jobid = %i and owner =\
             '%s'"%(self._jobid.getId(),self._jobid.getOwner())).all()
     for state in statearr:
       self._states[state.pkey] = state.pvalue
   self.updateState("__Registration__", "Completed job registration")
示例#3
0
 def __init__(self, jobdescription="", jobid=None, ip = None):
   self._tasknumber = None
   self._conn = engine.connect()
   if jobid is None:
     jobid = session.query(func.max(CatalogEventLog.c.jobid)).one()[0]
     if jobid is None:
       self._jobid = 1
     else:
       self._jobid = jobid + 1
   else:
     self._jobid = int(jobid)
   self._jobdescription = jobdescription
   if ip is None:
     self._ip = socket.gethostbyname(socket.gethostname())
   else:
     self._ip = ip
   self.persist('__REGISTRATION__', 'Registered job %i'%self._jobid, '')
示例#4
0
 def getJobIdsByOwner(self, owner):
   jids = []
   idarr = session.query(func.distinct(JobStateLog.c.jobid)).filter("owner = '%s'"%(owner)).all()
   for id in idarr:
     jids.append(JobId(id[0], owner))
   return jids