You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After finding errors in my metadata file, I deleted the _.nwb file, raw data .nwb file under stelmo/nwb/raw, as well as the corresponding entry on the Nwbfile() table for the dataset "Lewis20240222". I was able to recreate an nwb raw file with the correct metadata file, but when I was trying to reinsert the raw data into the Nwbfile() table via
[12:05:01][INFO] Spyglass: CreatingacopyofNWBfileLewis20240222.nwbwithlinktorawephysdata: Lewis20240222_.nwb/home/xulu/anaconda3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoringcachednamespace'hdmf-common'version1.8.0becauseversion1.5.1isalreadyloaded.
warn("Ignoring cached namespace '%s' version %s because version %s is already loaded."/home/xulu/anaconda3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoringcachednamespace'core'version2.6.0-alphabecauseversion2.5.0isalreadyloaded.
warn("Ignoring cached namespace '%s' version %s because version %s is already loaded."/home/xulu/anaconda3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoringcachednamespace'hdmf-experimental'version0.5.0becauseversion0.2.0isalreadyloaded.
warn("Ignoring cached namespace '%s' version %s because version %s is already loaded."---------------------------------------------------------------------------DataJointErrorTraceback (mostrecentcalllast)
CellIn [6], line1---->1sgi.insert_sessions(nwb_file_name)
File~/code/spyglass/src/spyglass/data_import/insert_sessions.py:68, ininsert_sessions(nwb_file_names)
64# Make a copy of the NWB file that ends with '_'.65# This has everything except the raw data but has a link to66# the raw data in the original file67copy_nwb_link_raw_ephys(nwb_file_name, out_nwb_file_name)
--->68Nwbfile().insert_from_relative_file_name(out_nwb_file_name)
69populate_all_common(out_nwb_file_name)
File~/code/spyglass/src/spyglass/common/common_nwbfile.py:75, inNwbfile.insert_from_relative_file_name(cls, nwb_file_name)
73key["nwb_file_name"] =nwb_file_name74key["nwb_file_abs_path"] =nwb_file_abs_path--->75cls.insert1(key, skip_duplicates=True)
File~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/table.py:334, inTable.insert1(self, row, **kwargs)
327definsert1(self, row, **kwargs):
328""" 329 Insert one data record into the table. For ``kwargs``, see ``insert()``. 330 331 :param row: a numpy record, a dict-like object, or an ordered sequence to be inserted 332 as one row. 333 """-->334self.insert((row,), **kwargs)
File~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/table.py:409, inTable.insert(self, rows, replace, skip_duplicates, ignore_extra_fields, allow_direct_insert)
406return408field_list= [] # collects the field list from first row (passed by reference)-->409rows=list(
410self.__make_row_to_insert(row, field_list, ignore_extra_fields)
411forrowinrows412 )
413ifrows:
414try:
File~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/table.py:410, in<genexpr>(.0)
406return408field_list= [] # collects the field list from first row (passed by reference)409rows=list(
-->410self.__make_row_to_insert(row, field_list, ignore_extra_fields)
411forrowinrows412 )
413ifrows:
414try:
File~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/table.py:896, inTable.__make_row_to_insert(self, row, field_list, ignore_extra_fields)
894elifisinstance(row, collections.abc.Mapping): # dict-based895check_fields(row)
-->896attributes= [
897self.__make_placeholder(name, row[name], ignore_extra_fields)
898fornameinself.heading899ifnameinrow900 ]
901else: # positional902try:
File~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/table.py:897, in<listcomp>(.0)
894elifisinstance(row, collections.abc.Mapping): # dict-based895check_fields(row)
896attributes= [
-->897self.__make_placeholder(name, row[name], ignore_extra_fields)
898fornameinself.heading899ifnameinrow900 ]
901else: # positional902try:
File~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/table.py:858, inTable.__make_placeholder(self, name, value, ignore_extra_fields)
852value= (
853str.encode(attachment_path.name)
854+b"\0"855+attachment_path.read_bytes()
856 )
857elifattr.is_filepath:
-->858value=self.external[attr.store].upload_filepath(value).bytes859elifattr.numeric:
860value=str(int(value) ifisinstance(value, bool) elsevalue)
File~/anaconda3/envs/spyglass/lib/python3.9/site-packages/datajoint/external.py:279, inExternalTable.upload_filepath(self, local_filepath)
276ifcheck_hash:
277# the tracking entry exists, check that it's the same file as before278ifcontents_hash!=check_hash[0]:
-->279raiseDataJointError(
280f"A different version of '{relative_filepath}' has already been placed."281 )
282else:
283# upload the file and create its tracking entry284self._upload_file(
285local_filepath,
286self._make_external_filepath(relative_filepath),
287metadata={"contents_hash": str(contents_hash)},
288 )
DataJointError: Adifferentversionof'Lewis20240222_.nwb'hasalreadybeenplaced.
How could I clean up all traces of creating the older, incorrect nwb file besides deleting the corresponding raw data & table? Thanks!
The text was updated successfully, but these errors were encountered:
This looks to me like the externals table still has a record of this file. You can access it with the following, and then delete the entry. This delete is currently run during the nightly cleanup
from {module} fetchschema
(schema.externals['analysis'] &your_restriction)
A future version of Spyglass could use the delete method to anticipate these deletes and include them whenever a delete is performed on a table with a fk ref to AnalysisNwbfile. Similarly with IntervalList orphans.
CBroz1
changed the title
A different version of file name" has already been placed when inserting nwbfile
Delete should prevent orphans in externals and IntervalListApr 30, 2024
I think I finally figured what may be going on -- after deleting the entry from the Nwbfile table, I should also do a cleanup of the file paths. I was able to reinsert the data after that =)
After finding errors in my metadata file, I deleted the _.nwb file, raw data .nwb file under stelmo/nwb/raw, as well as the corresponding entry on the Nwbfile() table for the dataset "Lewis20240222". I was able to recreate an nwb raw file with the correct metadata file, but when I was trying to reinsert the raw data into the Nwbfile() table via
It gives the following error:
Error Stack
How could I clean up all traces of creating the older, incorrect nwb file besides deleting the corresponding raw data & table? Thanks!
The text was updated successfully, but these errors were encountered: