def add_process_db(session, fid, outvalue): """ Add a process run to the database. Parameters ---------- session : Session The database session to which the process will be added. fid : str The file id. outvalue : str The return value / output of the process that will be added to the database. Returns ------- : str "SUCCESS" on success, "ERROR" on failure """ # pdb.set_trace() date = datetime.datetime.now(pytz.utc).strftime("%Y-%m-%d %H:%M:%S") processDB = pds_models.ProcessRuns(fileid=fid, process_date=date, process_typeid='5', process_out=outvalue) try: session.merge(processDB) session.commit() return 'SUCCESS' except: return 'ERROR'
def AddProcessDB(session, fid, outvalue): # pdb.set_trace() date = datetime.datetime.now(pytz.utc).strftime("%Y-%m-%d %H:%M:%S") processDB = pds_models.ProcessRuns(fileid=fid, process_date=date, process_typeid='5', process_out=outvalue) try: session.merge(processDB) session.commit() return 'SUCCESS' except: return 'ERROR'