question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Including a .json sidecar for events.tsv files causes a SQLAlchemy Tag conflict

See original GitHub issue

We have an fMRIPrep user experiencing the following issue (more details here https://neurostars.org/t/naming-of-bids-events-tsv-files-seems-to-disrupt-fmriprep-1-5-0rc1/4771):

  File "/usr/local/miniconda/lib/python3.7/site-packages/fmriprep/cli/run.py", line 524, in build_workflow
    layout = BIDSLayout(str(bids_dir), validate=False)
  File "/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/layout.py", line 212, in __init__
    indexer.index_metadata()
  File "/usr/local/miniconda/lib/python3.7/site-packages/bids/layout/index.py", line 338, in index_metadata
    self.session.commit()
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1027, in commit
    self.transaction.commit()
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 494, in commit
    self._prepare_impl()
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 473, in _prepare_impl
    self.session.flush()
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2459, in flush
    self._flush(objects)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2597, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 153, in reraise
    raise value
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2557, in _flush
    flush_context.execute()
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
    rec.execute(self)
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute
    uow,
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 213, in save_obj
    ) in _organize_states_for_save(base_mapper, states, uowtransaction):
  File "/usr/local/miniconda/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 408, in _organize_states_for_save
    % (state_str(state), instance_key, state_str(existing))
sqlalchemy.orm.exc.FlushError: New instance <Tag at 0x2b66784f7ba8> with identity key (<class 'bids.layout.models.Tag'>, ('/inp/sub-02/func/sub-02_task-Emotion_run-1_events.tsv', 'run'), None) conflicts with persistent instance <Tag at 0x2b66784c6630>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
tyarkonicommented, Aug 7, 2019

@oesteban I fixed this in #468; we’ll cut a new release as soon as it’s merged so you can update fmriprep. Thanks for reporting!

1reaction
tyarkonicommented, Aug 7, 2019

Per discussion in the linked NeuroStars thread, this seems like a bug induced by the inclusion of a .json file with the same filename (except for extension) as an events.tsv file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tracking queries, object and Session Changes with Events
On this page: Tracking queries, object and Session Changes with Events. Execute Events. Basic Query Interception; Adding global WHERE / ON criteria ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found