Skip to content
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

DM-46747 refactor pqserver per SQR-072 #65

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Conversation

bbrondel
Copy link
Collaborator

@bbrondel bbrondel commented Jan 7, 2025

This divides the functionality in pqserver into separate units. It also switches from using a Connection object to Session objects so that sqlalchemy is managing a connection pool.

Note that the error behavior is not preserved by this change. My impression is that no one is relying on the existing error behavior, so it is to our advantage to move to error formats that are provided by FastAPI.

@bbrondel bbrondel requested a review from Vebop January 7, 2025 19:03
python/lsst/consdb/cdb_schema.py Outdated Show resolved Hide resolved
python/lsst/consdb/cdb_schema.py Show resolved Hide resolved

instrument = instrument.lower()
logger = logging.getLogger()
engine = get_engine()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not have this as a parameter and def get_instrument_table(..., engine = Depends(get_engine)):



def get_instrument_list():
global instrument_list
Copy link
Collaborator

Choose a reason for hiding this comment

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

In this case I think instrument_list should be a parameter.

def validate_instrument_name(
instrument: str = Path(description="Must be a valid instrument name (e.g., ``LATISS``)"),
) -> str:
print(f"validate_instrument_name({instrument=})")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove some print statements or turn them into logging when this is not 'draft'
image

python/lsst/consdb/dependencies.py Show resolved Hide resolved
)

# Check SQLAlchemy version
required_version = (2, 0, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we could put this in our requirements.txt or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've removed the version check from the code, but I think setting up requirements.txt or similar calls for a new ticket. The needs of consdb are fairly complicated given that there are several products coming from this repository.

Copy link
Contributor

@JeremyMcCormick JeremyMcCormick Jan 14, 2025

Choose a reason for hiding this comment

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

If you wanted to add requirements on such a major refactoring, that seems fine - I don't see that needing its own ticket.

python/lsst/consdb/handlers/external.py Outdated Show resolved Hide resolved
python/lsst/consdb/models.py Outdated Show resolved Hide resolved
python/lsst/consdb/models.py Outdated Show resolved Hide resolved
@bbrondel bbrondel requested a review from ktlim January 15, 2025 20:30
@bbrondel bbrondel marked this pull request as ready for review January 15, 2025 20:30
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