APS-4ID-POLAR / polartools

Python package to read and process data from the APS Polar beamline.
https://polartools.readthedocs.io/en/latest/
Other
2 stars 2 forks source link

`manage_database.to_databroker` bug #60

Open gfabbris opened 2 years ago

gfabbris commented 2 years ago

It works with external files only if suitcase-utils = 0.5.3.

gfabbris commented 2 years ago

Same error if I use the command line app (databroker-pack).

gfabbris commented 2 years ago
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/beams/POLAR/.conda/envs/polartools-dev/lib/python3.9/site-packages/databroker_pack/_pack.py", line 228, in export_catalog
    artifacts, files = export_run(
  File "/home/beams/POLAR/.conda/envs/polartools-dev/lib/python3.9/site-packages/databroker_pack/_pack.py", line 356, in export_run
    progress.update()
  File "/home/beams/POLAR/.conda/envs/polartools-dev/lib/python3.9/site-packages/suitcase/msgpack/__init__.py", line 167, in __exit__
    self.close()
  File "/home/beams/POLAR/.conda/envs/polartools-dev/lib/python3.9/site-packages/suitcase/msgpack/__init__.py", line 161, in close
    self._manager.close()
  File "/home/beams/POLAR/.conda/envs/polartools-dev/lib/python3.9/site-packages/suitcase/utils/__init__.py", line 266, in close
    a.handle.close()
  File "/home/beams/POLAR/.conda/envs/polartools-dev/lib/python3.9/site-packages/suitcase/utils/__init__.py", line 93, in wrapped_close
    handle.seek(0, os.SEEK_END)
ValueError: seek of closed file
Writing Documents (7 failures): 100%|█████████████████████████████████████| 7/7 [00:01<00:00,  4.01it/s]
--------------------------------------------------------------------------- 7/7 [00:01<00:00,  4.80it/s]
KeyError                                  Traceback (most recent call last)
<ipython-input-11-5b093a9715f0> in <module>
----> 1 to_databroker(searched, "export_extras3", external=True)

/home/sector4/4idd/2021_2/RXES_Gilberto/manage_db.py in to_databroker(db, folder, query, external)
     65 
     66     artifacts, external_files, _, _ = export_catalog(results, manager)
---> 67     write_documents_manifest(manager, folder, artifacts["all"])
     68 
     69     root_map = {}

The first part of the error happens for every external file.