libAtoms / abcd

1 stars 4 forks source link

delete --yes on empty database gives error #99

Closed bernstei closed 3 years ago

bernstei commented 3 years ago
> abcd login mongodb://localhost:27017/pipeline_test; abcd delete --yes; abcd summary
Successfully connected to the database!
 type:       mongodb
 hostname:   localhost
 port:       27017
 database:   pipeline_test
 # of confs: 0
<pymongo.results.DeleteResult object at 0x10f9fe4c0> configuration has been deleted
Total number of configurations: 0
Traceback (most recent call last):
  File "/Users/bernstei/Library/Python/3.8/bin/abcd", line 8, in <module>
    sys.exit(main())
  File "/Users/bernstei/Library/Python/3.8/lib/python/site-packages/abcd/frontends/commandline/parser.py", line 121, in main
    callback_func(**kwargs)
  File "/Users/bernstei/Library/Python/3.8/lib/python/site-packages/abcd/frontends/commandline/decorators.py", line 15, in wrapper
    func(*args, config=config, **kwargs)
  File "/Users/bernstei/Library/Python/3.8/lib/python/site-packages/abcd/frontends/commandline/decorators.py", line 48, in wrapper
    func(*args, db=db, query=query, **kwargs)
  File "/Users/bernstei/Library/Python/3.8/lib/python/site-packages/abcd/frontends/commandline/commands.py", line 121, in summary
    f.hist_labels(counts, categories, dtypes, labels)
  File "/Users/bernstei/Library/Python/3.8/lib/python/site-packages/abcd/frontends/commandline/commands.py", line 317, in hist_labels
    width_count = len(str(max(counts)))
ValueError: max() arg is an empty sequence
gabor1 commented 3 years ago

this is a known bug, the database is unhappy to give a summary if there are no configurations that passed the filter. simple to catch and fix, on the list.