|
4 | 4 | from apscheduler.schedulers.blocking import BlockingScheduler |
5 | 5 | from apscheduler.util import undefined |
6 | 6 |
|
| 7 | +from file_automation.utils.logging.loggin_instance import file_automation_logger |
| 8 | + |
7 | 9 |
|
8 | 10 | class SchedulerManager(object): |
9 | 11 |
|
@@ -38,9 +40,15 @@ def get_nonblocking_scheduler(self): |
38 | 40 | return self._background_schedulers |
39 | 41 |
|
40 | 42 | def start_block_scheduler(self, *args, **kwargs): |
| 43 | + file_automation_logger.info( |
| 44 | + f"Start blocking scheduler with {args}, {kwargs}" |
| 45 | + ) |
41 | 46 | self._blocking_schedulers.start(*args, **kwargs) |
42 | 47 |
|
43 | 48 | def start_nonblocking_scheduler(self, *args, **kwargs): |
| 49 | + file_automation_logger.info( |
| 50 | + f"Start background scheduler with {args}, {kwargs}" |
| 51 | + ) |
44 | 52 | self._background_schedulers.start(*args, **kwargs) |
45 | 53 |
|
46 | 54 | def start_all_scheduler(self, *args, **kwargs): |
@@ -116,13 +124,25 @@ def add_cron_nonblocking( |
116 | 124 | self.add_nonblocking_job(func=function, id=id, trigger="cron", **trigger_args) |
117 | 125 |
|
118 | 126 | def remove_blocking_job(self, id: str, jobstore: str = 'default'): |
| 127 | + file_automation_logger.info( |
| 128 | + f"Remove blocking job {id}, store on {jobstore}" |
| 129 | + ) |
119 | 130 | self._blocking_schedulers.remove_job(job_id=id, jobstore=jobstore) |
120 | 131 |
|
121 | 132 | def remove_nonblocking_job(self, id: str, jobstore: str = 'default'): |
| 133 | + file_automation_logger.info( |
| 134 | + f"Remove nonblocking job {id}, store on {jobstore}" |
| 135 | + ) |
122 | 136 | self._background_schedulers.remove_job(job_id=id, jobstore=jobstore) |
123 | 137 |
|
124 | 138 | def shutdown_blocking_scheduler(self, wait: bool = False): |
| 139 | + file_automation_logger.info( |
| 140 | + f"Shutdown blocking scheduler wait = {wait}" |
| 141 | + ) |
125 | 142 | self._blocking_schedulers.shutdown(wait=wait) |
126 | 143 |
|
127 | 144 | def shutdown_nonblocking_scheduler(self, wait: bool = False): |
| 145 | + file_automation_logger.info( |
| 146 | + f"Shutdown nonblocking scheduler wait = {wait}" |
| 147 | + ) |
128 | 148 | self._background_schedulers.shutdown(wait=wait) |
0 commit comments