コード例 #1
0
ファイル: jobsvc.py プロジェクト: jazlee/csp-accounting
  def updateJobStatus(self, jobID, status, msg):
    from tbl import EFJBLS
    from elixir import session
    session.close()
    obj = EFJBLS.query.filter_by(JBLSIDNM = jobID).first()

    pgmName = None
    if obj:
      pgmName = obj.JBLSPRPG
      now = dt.datetime.now()
      if obj.JBLSPRDT is None:
        obj.JBLSPRDT = now.date().tointeger()
      if obj.JBLSPRTM is None:
        obj.JBLSPRTM = now.time().tointeger()
      obj.JBLSUPDT = now.date().tointeger()
      obj.JBLSUPTM = now.time().tointeger()
      obj.JBLSPRST = status
      if msg:
        msg = msg[:64]
      obj.JBLSPRMS = msg
      if not session.transaction_started():
        session.begin()
      try:
        session.update(obj)
        session.commit()
      except:
        session.rollback()
        raise
    return pgmName
 def adminLogin(self, request, context):
     try:
         res = admin_login(request)
         if not res:
             raise
         return smartnet_pb2.Admin(id=res.id,
                                   role=res.role,
                                   email=res.email,
                                   first_name=res.first_name,
                                   last_name=res.last_name)
     finally:
         session.close()
コード例 #3
0
ファイル: jobsvc.py プロジェクト: jazlee/csp-accounting
 def executeJob(self, jobsession):
   # object = self.getObject(obj)
   # return object.executeJob(*args)
   try:
     pgmName = self.updateJobStatus(jobsession.jobID, 10, None)
     try:
       if not pgmName:
         raise Exception('No JOB Processor defined for jobID=%s' % jobsession.jobID)
       pgmObj = self.getObject(pgmName)
       # try to compile first before doing job execution
       compile_obj_to_native(pgmObj)
       pgmObj.executeJob(jobsession)
       self.updateJobStatus(jobsession.jobID, 100, None)
     except Exception, e:
       self.updateJobStatus(jobsession.jobID, 99, e.message)
       raise
   finally:
     session.close()
コード例 #4
0
 def tearDown(self):
     session.close()
     drop_all()
コード例 #5
0
ファイル: __init__.py プロジェクト: hoozifachi/hubbub
def reset():
    session.close()
    drop_all()