Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tcjennings committed Jan 30, 2025
1 parent 3bbbe5a commit 0eaceab
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

build:
name: "Build and Push Application Container Images"
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
strategy:
matrix:
include:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
./.github/workflows/rebase_checker.yaml

lint:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
needs:
- rebase-checker
steps:
Expand All @@ -36,7 +36,7 @@ jobs:
uses: pre-commit/[email protected]

mypy:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
Expand All @@ -60,7 +60,7 @@ jobs:
run: uv run make typing

test:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:

jobs:
release:
runs-on: ubuntu-24.04-arm
runs-on: ubuntu-latest
timeout-minutes: 10
if: >-
github.event_name == 'pull_request'
Expand Down
3 changes: 2 additions & 1 deletion src/lsst/cmservice/common/butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from lsst.daf.butler import Butler, ButlerConfig, ButlerRepoIndex
from lsst.daf.butler._exceptions import MissingCollectionError
from lsst.resources import ResourcePathExpression
from lsst.utils.db_auth import DbAuth

from ..config import config
Expand All @@ -30,7 +31,7 @@ async def get_butler_config(repo: str, *, without_datastore: bool = False) -> Bu
"""

try:
repo_uri = BUTLER_REPO_INDEX.get_repo_uri(label=repo)
repo_uri: ResourcePathExpression = BUTLER_REPO_INDEX.get_repo_uri(label=repo)
except KeyError:
# No such repo known to the service
logger.warning("Butler repo %s not known to environment.", repo)
Expand Down
5 changes: 0 additions & 5 deletions src/lsst/cmservice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ class ButlerConfiguration(BaseModel):
default="rubin",
)

access_token: str | None = Field(
description=("Gafaelfawr access token used to authenticate to a Butler server."),
default=None,
)

mock: bool = Field(
description="Whether to mock out Butler calls.",
default=False,
Expand Down
21 changes: 8 additions & 13 deletions tests/common/test_butler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import json
from typing import Any

import pytest

from lsst.cmservice.common.butler import get_butler_config, parse_butler_repos_from_environment
from lsst.cmservice.common.butler import get_butler_config
from lsst.cmservice.config import config
from lsst.daf.butler.registry import RegistryConfig

Expand Down Expand Up @@ -31,13 +32,12 @@ def mock_butler_environment(tmp_path: Any, monkeypatch: Any) -> None:
"""
repo_mockgres_butler_yaml.write_text(repo_yaml)

monkeypatch.setenv("BUTLER__REPO__0__NAME", "/repo/mock")
monkeypatch.setenv("BUTLER__REPO__0__URI", f"{repo_mock_path}")
monkeypatch.setenv("BUTLER__REPO__1__NAME", "/repo/mockgres")
monkeypatch.setenv("BUTLER__REPO__1__URI", f"{repo_mockgres_butler_yaml}")
monkeypatch.setenv("BUTLER__REPO__2__NAME", "mockbargo")
monkeypatch.setenv("BUTLER__REPO__2__URI", "s3://bucket/prefix/object.yaml")
monkeypatch.setenv("BUTLER__REPO__3__NAME", "nosuchrepo")
daf_butler_repositories = {
"/repo/mock": f"{repo_mock_path}",
"/repo/mockgres": f"{repo_mockgres_butler_yaml}",
"mockbargo": "s3://bucket/prefix/object.yaml",
}
monkeypatch.setenv("DAF_BUTLER_REPOSITORIES", json.dumps(daf_butler_repositories))


@pytest.fixture
Expand All @@ -52,11 +52,6 @@ def mock_db_auth_file(tmp_path: Any, monkeypatch: Any) -> None:
monkeypatch.setattr(config.butler, "authentication_file", str(mock_auth_path))


def test_parse_butler_config_from_environment(mock_butler_environment: Any) -> None:
repos = parse_butler_repos_from_environment()
assert len(repos.keys()) == 3


@pytest.mark.asyncio
async def test_butler_creation_without_db_auth_file(mock_butler_environment: Any) -> None:
bc = await get_butler_config("/repo/mock", without_datastore=True)
Expand Down

0 comments on commit 0eaceab

Please sign in to comment.