| 76 | utils.conn_db(self.collection).update_one(query, update) |
| 77 | |
| 78 | def statistic(self): |
| 79 | query = {"_id": ObjectId(self.task_id)} |
| 80 | table_list = ['github_result'] |
| 81 | result = {} |
| 82 | for table in table_list: |
| 83 | cnt = utils.conn_db(table).count_documents({"github_task_id": self.task_id}) |
| 84 | stat_key = table + "_cnt" |
| 85 | result[stat_key] = cnt |
| 86 | |
| 87 | logger.info("insert task stat") |
| 88 | update = {"$set": {"statistic": result}} |
| 89 | utils.conn_db(self.collection).update_one(query, update) |
| 90 | |
| 91 | def run(self): |
| 92 | self.set_start_time() |