Skip to content

Conversation

@CBroz1
Copy link
Member

@CBroz1 CBroz1 commented Oct 3, 2025

Description

This PR replaces our upstream_hash protections with the generator-make approach in datajoint 0.14.6

  • common.LFP
  • MoseqModel
  • FigURLCuration
  • Waveforms
  • QualityMetrics
  • CuratedSpikeSorting
  • DLCModelTraining
  • SpikeSorting
  • MetricCuration
  • SpikeSortingRecording

Checklist:

  • NA. If this PR should be accompanied by a release, I have updated the CITATION.cff
  • NA. If this PR edits table definitions, I have included an alter snippet for release notes.
  • If this PR makes changes to position, I ran the relevant tests locally.
  • NA. If this PR makes user-facing changes, I have added/edited docs/notebooks to reflect the changes
  • I have updated the CHANGELOG.md with PR number and description.

@codecov
Copy link

codecov bot commented Oct 3, 2025

Codecov Report

❌ Patch coverage is 63.68421% with 69 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.09%. Comparing base (b17c225) to head (e476f51).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/spyglass/behavior/v1/moseq.py 0.00% 23 Missing ⚠️
src/spyglass/position/v1/position_dlc_training.py 29.16% 17 Missing ⚠️
src/spyglass/common/common_ephys.py 15.78% 16 Missing ⚠️
.../spyglass/spikesorting/v0/spikesorting_curation.py 93.15% 5 Missing ⚠️
src/spyglass/spikesorting/v1/figurl_curation.py 37.50% 5 Missing ⚠️
src/spyglass/common/common_interval.py 50.00% 1 Missing ⚠️
...spyglass/spikesorting/v0/spikesorting_recording.py 91.66% 1 Missing ⚠️
...c/spyglass/spikesorting/v0/spikesorting_sorting.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1422      +/-   ##
==========================================
- Coverage   71.35%   71.09%   -0.26%     
==========================================
  Files         114      114              
  Lines       13282    13370      +88     
==========================================
+ Hits         9477     9506      +29     
- Misses       3805     3864      +59     
Flag Coverage Δ
full-tests 71.09% <63.68%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CBroz1 CBroz1 requested a review from Copilot October 29, 2025 19:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the populate transaction workaround by implementing a tripartite make method pattern across multiple Spyglass tables. The changes split the traditional make method into three distinct methods: make_fetch (data retrieval), make_compute (computation), and make_insert (database insertion).

Key changes:

  • Removes _use_transaction class attribute and related transaction control logic from SpyglassMixin.populate()
  • Refactors 10+ Computed/Imported tables to use the tripartite make_fetch/make_compute/make_insert pattern
  • Replaces non-deterministic uuid.uuid4() calls with deterministic dj.hash.key_hash() for consistent naming

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tests/conftest.py Disables GPU for tests via environment variable
src/spyglass/utils/dj_mixin.py Removes transaction control logic and deprecates use_transaction kwarg
src/spyglass/spikesorting/v1/metric_curation.py Refactors to tripartite make pattern
src/spyglass/spikesorting/v1/figurl_curation.py Refactors to tripartite make pattern
src/spyglass/spikesorting/v0/spikesorting_sorting.py Refactors to tripartite make pattern
src/spyglass/spikesorting/v0/spikesorting_recording.py Extracts path validation to separate method
src/spyglass/spikesorting/v0/spikesorting_curation.py Refactors multiple classes to tripartite make pattern
src/spyglass/spikesorting/v0/spikesorting_burst.py Fixes static method call
src/spyglass/position/v1/position_dlc_training.py Refactors to tripartite make pattern
src/spyglass/position/v1/position_dlc_project.py Changes file_ext from enum to varchar
src/spyglass/common/common_interval.py Adds shape check for interval conversion
src/spyglass/common/common_ephys.py Refactors LFP table to tripartite make pattern
src/spyglass/behavior/v1/moseq.py Refactors to tripartite make pattern
docs/src/ForDevelopers/CustomPipelines.md Documents tripartite make pattern
docs/src/Features/Mixin.md Removes transaction protection documentation
CHANGELOG.md Notes infrastructure change
Comments suppressed due to low confidence (1)

src/spyglass/spikesorting/v0/spikesorting_sorting.py:307

  • Normal methods should have 'self', rather than 'key', as their first parameter.
    def make_insert(key, sorting_path, time_of_sort):

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CBroz1 CBroz1 marked this pull request as ready for review October 30, 2025 03:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@edeno edeno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @samuelbray32 do you see anything that would prevent merging?

IntervalList.insert1(lfp_valid_times.as_dict, replace=True)
AnalysisNwbfile().log(key, table=self.full_table_name)
self.insert1(key)
self.insert1(dict(key, **added_key))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.insert1(dict(key, **added_key))
AnalysisNwbfile().add(key["nwb_file_name"], lfp_file_name)
self.insert1(dict(key, **added_key))

This needs run down here now, no?

"KEY", limit=kwargs.get("limit", None)
)

if use_transact is False:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think people have custom tables that are using this feature. Do we want to give some time to migrate before removing it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Removing the feature was premature. Better to add deprecation warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants