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

Fix database constraint violation when program version strings contain uppercase characters #825

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion qcfractal/qcfractal/components/managers/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def activate(

# Strip out empty tags and programs
tags = [x.lower() for x in tags if len(x) > 0]
programs = {k.lower(): v for k, v in programs.items() if len(k) > 0}

# Some version strings can contain uppercase characters
programs = {k.lower(): [v.lower() for v in vlst] for k, vlst in programs.items() if len(k) > 0}

if len(tags) == 0:
raise ComputeManagerError("Manager does not have any tags assigned. Use '*' to match all tags")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,18 @@ def test_manager_mclient_activate_normalize(snowflake: QCATestingSnowflake):

mclient1.activate(
manager_version="v2.0",
programs={"qcengine": ["unknown"], "program1": ["v3.0"], "PROgRam2": ["v4.0"]},
programs={"qcengine": ["unknown"], "program1": ["v3.0"], "PROgRam2": ["v4.0"], "PROGRAM4": ["v5.0-AB"]},
tags=["tag1", "taG3", "tAg2", "TAG3", "TAG1"],
)

manager = client.get_managers(mname1.fullname)
assert manager.tags == ["tag1", "tag3", "tag2"]
assert manager.programs == {"qcengine": ["unknown"], "program1": ["v3.0"], "program2": ["v4.0"]}
assert manager.programs == {
"qcengine": ["unknown"],
"program1": ["v3.0"],
"program2": ["v4.0"],
"program4": ["v5.0-ab"],
}


def test_manager_mclient_activate_notags(snowflake: QCATestingSnowflake):
Expand Down
Loading