materialsproject/fireworks

lpad recover_offline doesn't work with pymongo>3.13.0

JosephMontoya-TRI opened this issue · 0 comments

When I use lpad recover_offline in v2.0.3 (with pymongo==4.6.0):

Traceback (most recent call last):
  File "/home/a30107/atomate/bin/lpad", line 33, in <module>
    sys.exit(load_entry_point('FireWorks', 'console_scripts', 'lpad')())
  File "/lustre0/home/a30107/atomate/lib/python3.9/site-packages/FireWorks-2.0.3-py3.9.egg/fireworks/scripts/lpad_run.py", line 1551, in lpad
    args.func(args)
  File "/lustre0/home/a30107/atomate/lib/python3.9/site-packages/FireWorks-2.0.3-py3.9.egg/fireworks/scripts/lpad_run.py", line 767, in recover_offline
    if fworker_name and lp.launches.count({"launch_id": l["launch_id"], "fworker.name": fworker_name}) == 0:
  File "/lustre0/home/a30107/atomate/lib/python3.9/site-packages/pymongo/collection.py", line 3166, in __call__
    raise TypeError(
TypeError: 'Collection' object is not callable. If you meant to call the 'count' method on a 'Collection' object it is failing because no such method exists.

I think this is just because Collection.count is deprecated. I think the fix should be straightforward, just update the second condition on line 767 of lpad_run.py to use the more recent method of counting documents. Wanted to raise the issue just in case it falls off my radar and I don't have time to issue a proper fix.