Verify that the job name exists in the collection. If the job does not exist, this will create it.
(self, job_name)
| 72 | self._job_name = job_name |
| 73 | |
| 74 | def __check_job_exists(self, job_name): |
| 75 | """ |
| 76 | Verify that the job name exists in the collection. |
| 77 | If the job does not exist, this will create it. |
| 78 | """ |
| 79 | if ( |
| 80 | self._mongo_connector.perform_count( |
| 81 | self._jobs_collection, {"job_name": job_name} |
| 82 | ) |
| 83 | == 0 |
| 84 | ): |
| 85 | now = datetime.now() |
| 86 | self._mongo_connector.perform_insert( |
| 87 | self._jobs_collection, |
| 88 | {"job_name": job_name, "status": self.NOT_RUN, "updated": now}, |
| 89 | ) |
| 90 | |
| 91 | def create_job(self, job_name): |
| 92 | """ |
no test coverage detected