galaxyproject / galaxyproject/galaxy

Celery tasks should get a task-scoped session

Open
#12,964 0 comments 0 reactions 0 assignees View on GitHub
area/database planning
Dominant language
Python
Stars
1.9k
Forks
1.2k
Avg merge
2d 16h
Merged PRs (30d)
169

Description

We scope sqlalchemy sessions based on the request id, or else by thread (the sqlalchemy default) in https://github.com/galaxyproject/galaxy/blob/cdcf3c147972625f3db6c02c9ae23dc42659addc/lib/galaxy/model/base.py#L38

We should probably ensure that celery tasks receive a fresh session that is discarded after the task has completed.
xref https://github.com/galaxyproject/galaxy/pull/12963#discussion_r754421690

Contributor guide

Open the contributing guide

Research direction

Start with lib/galaxy/model/base.py at line 38 to understand the existing request- and thread-scoped SQLAlchemy sessions, then review the referenced discussion in pull request 12963. Done means Celery tasks receive a fresh session and that session is discarded when each task completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.