Open
Description
I get the following error when testing this on my system using 3rd party package that uses MongoClient
(3.2.2). I can see however, that indeed Collection
does not support __call__
method.
To reproduce, I modified Collection.find(...) to raise the AutoReconnect
exception. Below is a short usage snippet:
database='apscheduler'
collection='jobs'
self.client = MongoClient(**connect_args)
self.safe_conn = mongo_proxy.MongoProxy(self.client)
self.collection = self.safe_conn[database][collection]
self.collection.find(....)
Error:
Exception in thread APScheduler:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/apscheduler/schedulers/blocking.py", line 27, in _main_loop
wait_seconds = self._process_jobs()
File "/usr/local/lib/python2.7/dist-packages/apscheduler/schedulers/base.py", line 801, in _process_jobs
for job in jobstore.get_due_jobs(now):
File "/usr/local/lib/python2.7/dist-packages/apscheduler/jobstores/mongodb.py", line 69, in get_due_jobs
return self._get_jobs({'next_run_time': {'$lte': timestamp}})
File "/usr/local/lib/python2.7/dist-packages/apscheduler/jobstores/mongodb.py", line 122, in _get_jobs
for document in self.collection.find(conditions, ['_id', 'job_state'], sort=[('next_run_time', ASCENDING)]):
File "build/bdist.linux-x86_64/egg/mongo_proxy/mongodb_proxy.py", line 96, in __call__
conn.disconnect()
File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line 2356, in __call__
self.__name.split(".")[-1])
TypeError: 'Collection' object is not callable. If you meant to call the 'disconnect' method on a 'Collection' object it is failing because no such method exists.
Metadata
Metadata
Assignees
Labels
No labels