def _mark_failed(self): exc_type, exc_value, exc_traceback = sys.exc_info() db = self._job_db doc = self._job_doc doc['status'] = 'failed' doc['error'] = exc_value.__repr__() doc['trace'] = format_exception(exc_type, exc_value, exc_traceback) doc['updated_at'] = datetime_str() db.save_doc(doc)
def _store_result(self): root = self._root project_db = self._project_db # Copy template files if exist if self._templatedir: if os.path.isdir(self._templatedir) == True: shutil.copytree(self._templatedir, os.path.join(root, 'build/_attachments/t')) # TODO: maybe heavy bottlenecks, fix me for performance tu doc = FSDoc(os.path.join(root, 'build'), is_ddoc=False).doc(project_db) now = datetime_str() doc['created_at'] = now doc['updated_at'] = now doc['type'] = 'build' project_db.save_doc(doc, encode_attachments=False, force_update=True)
def _mark_success(self): db = self._job_db doc = self._job_doc doc['status'] = 'success' doc['updated_at'] = datetime_str() db.save_doc(doc)
def _lock_job(self): db = self._job_db doc = self._job_doc doc['status'] = 'processing' doc['updated_at'] = datetime_str() db.save_doc(doc)