Skip to content

Commit

Permalink
Warn if check is_stored for plugin not saved
Browse files Browse the repository at this point in the history
  • Loading branch information
cfuselli committed Jan 26, 2024
1 parent 2e4c48a commit 5a05273
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions strax/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1988,6 +1988,22 @@ def is_stored(self, run_id, target, **kwargs):
if self._is_stored_in_sf(run_id, target, sf):
return True
# None of the frontends has the data

# Before returning False, check if the data can be made trivially
plugin = self._plugin_class_registry[target]
save_when = plugin.save_when

# Mutli-target plugins provide a save_when per target
if isinstance(save_when, immutabledict):
save_when = save_when[target]

if save_when < 3: # 3 is SaveWhen.ALWAYS
warnings.warn(
f"The plugin for target '{target}' is not set to always save data. "
f"This is probably because the data can be trivially made from other data. "
f"The plugin depends on {plugin.depends_on}. Check if these are stored."
)

return False

def _check_forbidden(self):
Expand Down

0 comments on commit 5a05273

Please sign in to comment.