def _get_job_property(self, prop_name): cmd = lambda: self.mongo.mongo_db["__jobs__"].find( {"_id": self.job_id}, {prop_name: 1}) cursor = self.mongo.mongo_with_retries("_get_job_property", cmd) value = utils.safe_cursor_value(cursor, prop_name) return value
def get_run_property(self, ws_name, run_name, prop_name): cmd = lambda: self.mongo_db[ws_name].find({"_id": run_name}, {prop_name: 1}) cursor = self.mongo_with_retries("get_run_property", cmd) value = utils.safe_cursor_value(cursor, prop_name) return value
def ar_status_check(self, status): cursor = self.mongo.mongo_db["__jobs__"].find({"_id": self.job_id}, {"active_runs": 1}) active_runs = utils.safe_cursor_value(cursor, "active_runs") for ar in active_runs: ar_status = ar["status"] self._assert(ar_status == status)
def restart_status_check(self): cursor = self.mongo.mongo_db["__jobs__"].find({"_id": self.job_id}, {"active_runs": 1}) active_runs = utils.safe_cursor_value(cursor, "active_runs") for ar in active_runs: node_id = ar["node_id"] if node_id == self.node_id: ar_status = ar["status"] self.tester._assert(ar_status in [ constants.UNSTARTED, constants.WAITING, constants.COMPLETED ])
def get_legacy_end_id(self, ws_name): db = self.mongo_db doc_id = ws_name + "-end_id" cursor = db.ws_counters.find({"_id": doc_id}).limit(1) last_id = utils.safe_cursor_value(cursor, "last_id") return last_id