-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError
on non-spy table for _get_exp_summary()
#1031
Comments
this error is also triggered by automatic deletes, such as this command for populating SortGroup SortGroup().set_group_by_electrode_group(nwb_file_name) |
CBroz1
changed the title
problem with delete
Jul 14, 2024
ValueError
on non-spy table for _get_exp_summary()
the command i tried: (SortGroup & {'nwb_file_name' : 'CH73_20211209_.nwb'}).delete(force_permission=True) ---------------------------------------------------------------------------
NetworkXError Traceback (most recent call last)
File ~/spyglass/src/spyglass/utils/dj_mixin.py:334, in SpyglassMixin._part_masters(self)
333 try:
--> 334 _ = search_descendants(self)
335 except NetworkXError:
File ~/spyglass/src/spyglass/utils/dj_mixin.py:331, in SpyglassMixin._part_masters.<locals>.search_descendants(parent)
330 part_masters.add(master)
--> 331 search_descendants(dj.FreeTable(self.connection, master))
File ~/spyglass/src/spyglass/utils/dj_mixin.py:331, in SpyglassMixin._part_masters.<locals>.search_descendants(parent)
330 part_masters.add(master)
--> 331 search_descendants(dj.FreeTable(self.connection, master))
File ~/spyglass/src/spyglass/utils/dj_mixin.py:321, in SpyglassMixin._part_masters.<locals>.search_descendants(parent)
320 def search_descendants(parent):
--> 321 for desc in parent.descendants(as_objects=True):
322 if ( # Check if has master, is part
323 not (master := get_master(desc.full_table_name))
324 # has other non-master parent
325 or not set(desc.parents()) - set([master])
326 or master in part_masters # already in cache
327 ):
File ~/anaconda3/envs/spyglass2/lib/python3.9/site-packages/datajoint/table.py:212, in Table.descendants(self, as_objects)
205 """
206
207 :param as_objects: False - a list of table names; True - a list of table objects.
208 :return: list of tables descendants in topological order.
209 """
210 return [
211 FreeTable(self.connection, node) if as_objects else node
--> 212 for node in self.connection.dependencies.descendants(self.full_table_name)
213 if not node.isdigit()
214 ]
File ~/anaconda3/envs/spyglass2/lib/python3.9/site-packages/datajoint/dependencies.py:170, in Dependencies.descendants(self, full_table_name)
169 self.load(force=False)
--> 170 nodes = self.subgraph(nx.algorithms.dag.descendants(self, full_table_name))
171 return unite_master_parts(
172 [full_table_name] + list(nx.algorithms.dag.topological_sort(nodes))
173 )
File ~/anaconda3/envs/spyglass2/lib/python3.9/site-packages/networkx/algorithms/dag.py:53, in descendants(G, source)
52 if not G.has_node(source):
---> 53 raise nx.NetworkXError(f"The node {source} is not in the graph.")
54 des = {n for n, d in nx.shortest_path_length(G, source=source).items()}
NetworkXError: The node `jguidera_spikesorting`.`__spike_sorting_recording_cohort` is not in the graph.
During handling of the above exception, another exception occurred:
NetworkXError Traceback (most recent call last)
File ~/spyglass/src/spyglass/utils/dj_mixin.py:338, in SpyglassMixin._part_masters(self)
337 self._import_part_masters()
--> 338 _ = search_descendants(self)
339 except NetworkXError as e:
File ~/spyglass/src/spyglass/utils/dj_mixin.py:331, in SpyglassMixin._part_masters.<locals>.search_descendants(parent)
330 part_masters.add(master)
--> 331 search_descendants(dj.FreeTable(self.connection, master))
File ~/spyglass/src/spyglass/utils/dj_mixin.py:321, in SpyglassMixin._part_masters.<locals>.search_descendants(parent)
320 def search_descendants(parent):
--> 321 for desc in parent.descendants(as_objects=True):
322 if ( # Check if has master, is part
323 not (master := get_master(desc.full_table_name))
324 # has other non-master parent
325 or not set(desc.parents()) - set([master])
326 or master in part_masters # already in cache
327 ):
File ~/anaconda3/envs/spyglass2/lib/python3.9/site-packages/datajoint/table.py:212, in Table.descendants(self, as_objects)
205 """
206
207 :param as_objects: False - a list of table names; True - a list of table objects.
208 :return: list of tables descendants in topological order.
209 """
210 return [
211 FreeTable(self.connection, node) if as_objects else node
--> 212 for node in self.connection.dependencies.descendants(self.full_table_name)
213 if not node.isdigit()
214 ]
File ~/anaconda3/envs/spyglass2/lib/python3.9/site-packages/datajoint/dependencies.py:170, in Dependencies.descendants(self, full_table_name)
169 self.load(force=False)
--> 170 nodes = self.subgraph(nx.algorithms.dag.descendants(self, full_table_name))
171 return unite_master_parts(
172 [full_table_name] + list(nx.algorithms.dag.topological_sort(nodes))
173 )
File ~/anaconda3/envs/spyglass2/lib/python3.9/site-packages/networkx/algorithms/dag.py:53, in descendants(G, source)
52 if not G.has_node(source):
---> 53 raise nx.NetworkXError(f"The node {source} is not in the graph.")
54 des = {n for n, d in nx.shortest_path_length(G, source=source).items()}
NetworkXError: The node `jguidera_edeno_decoder_run`.`__edeno_decode` is not in the graph.
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
Cell In [5], line 3
1 SpikeSortingRecording & {'nwb_file_name' : 'CH73_20211209_.nwb'}
2 #(Nwbfile & {'nwb_file_name LIKE "CH73%"'}).fetch('nwb_file_name')
----> 3 (SortGroup & {'nwb_file_name' : 'CH73_20211209_.nwb'}).delete(force_permission=True)
File ~/spyglass/src/spyglass/utils/dj_mixin.py:691, in SpyglassMixin.delete(self, *args, **kwargs)
689 def delete(self, *args, **kwargs):
690 """Alias for cautious_delete, overwrites datajoint.table.Table.delete"""
--> 691 self.cautious_delete(*args, **kwargs)
File ~/spyglass/src/spyglass/utils/dj_mixin.py:658, in SpyglassMixin.cautious_delete(self, force_permission, dry_run, *args, **kwargs)
655 if not force_permission or dry_run:
656 self._check_delete_permission()
--> 658 down_fts = self.delete_downstream_parts(
659 dry_run=True,
660 disable_warning=True,
661 )
663 if dry_run:
664 return (
665 down_fts,
666 IntervalList(), # cleanup func relies on downstream deletes
667 external["raw"].unused(),
668 external["analysis"].unused(),
669 )
File ~/spyglass/src/spyglass/utils/dj_mixin.py:429, in SpyglassMixin.delete_downstream_parts(self, restriction, dry_run, reload_cache, disable_warning, return_graph, verbose, **kwargs)
426 if reload_cache:
427 _ = self.__dict__.pop("_part_masters", None)
--> 429 _ = self._part_masters # load cache before loading graph
430 restriction = restriction or self.restriction or True
432 restr_graph = RestrGraph(
433 seed_table=self,
434 leaves={self.full_table_name: restriction},
(...)
437 verbose=verbose,
438 )
File ~/anaconda3/envs/spyglass2/lib/python3.9/functools.py:993, in cached_property.__get__(self, instance, owner)
991 val = cache.get(self.attrname, _NOT_FOUND)
992 if val is _NOT_FOUND:
--> 993 val = self.func(instance)
994 try:
995 cache[self.attrname] = val
File ~/spyglass/src/spyglass/utils/dj_mixin.py:341, in SpyglassMixin._part_masters(self)
339 except NetworkXError as e:
340 table_name = "".join(e.args[0].split("`")[1:4])
--> 341 raise ValueError(f"Please import {table_name} and try again.")
343 logger.info(
344 f"Building part-parent cache for {self.camel_name}.\n\t"
345 + f"Found {len(part_masters)} downstream part tables"
346 )
348 return part_masters
ValueError: Please import jguidera_edeno_decoder_run.__edeno_decode and try again. |
7 tasks
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
im trying to run this delete command, which returns 1 entry from the IntervalLinearizedPosition table.
but, i get this error. im not sure why it is looking for a downstream table that i'm pretty sure does not use this nwb_file.
any help is appreciated, thanks!
The text was updated successfully, but these errors were encountered: