Replies: 1 comment 2 replies
-
You should place your scheduled functions in some other module than the one you use as the entry point for your app. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All , I am using Apscheduler 3.7.0
and trying to run schedule tasks , my application also runs celery for email notification sending , my problem is that celery is running the schedule task as well as the apscheduler , so I am task is being run twice , once by the apscheduler and once by celery
This is a snippet of my code that is trying to run a dummy function with apscheduler and assign celery as the executor of the task to resolve this issue
and I am getting this issue while trying to run :
[2023-01-31 13:52:00,011: ERROR/MainProcess] Unable to restore job "addInspectionEachHour" -- removing it
Traceback (most recent call last):
File "/home/talanonroot/anaconda3/envs/inspenv/lib/python3.6/site-packages/apscheduler/util.py", line 310, in ref_to_obj
obj = getattr(obj, name)
AttributeError: module 'main' has no attribute 'dummy_func'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/talanonroot/anaconda3/envs/inspenv/lib/python3.6/site-packages/apscheduler/jobstores/sqlalchemy.py", line 141, in _get_jobs
jobs.append(self._reconstitute_job(row.job_state))
File "/home/talanonroot/anaconda3/envs/inspenv/lib/python3.6/site-packages/apscheduler/jobstores/sqlalchemy.py", line 128, in _reconstitute_job
job.setstate(job_state)
File "/home/talanonroot/anaconda3/envs/inspenv/lib/python3.6/site-packages/apscheduler/job.py", line 273, in setstate
self.func = ref_to_obj(self.func_ref)
File "/home/talanonroot/anaconda3/envs/inspenv/lib/python3.6/site-packages/apscheduler/util.py", line 313, in ref_to_obj
raise LookupError('Error resolving reference %s: error looking up object' % ref)
LookupError: Error resolving reference main:dummy_func: error looking up object
Beta Was this translation helpful? Give feedback.
All reactions