Skip to content

Commit

Permalink
chore: update ruff formatting, remove pause, fixup actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tcjennings committed Jan 16, 2025
1 parent 4465fa8 commit 4935ef1
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 49 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/build_and_push.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
# A workflow that builds and (optionally) pushes the Docker container image
# artifacts for the application. The build action occurs on pull request events
# that target the `main` branch, and the push action occurs only with tagged releases
# and ticket branches.
# A workflow that builds and pushes the Docker container image artifacts for
# the application. The action occurs on new tags and when called from another
# workflow.
---
name: "Build and Push"

"on":
pull_request:
branches:
- main
paths:
- 'src/lsst/cmservice/**'
push:
tags:
- "*"
workflow_call:
workflow_dispatch:

jobs:
ci:
uses:
./.github/workflows/ci.yaml

build:
name: "Build and Push Application Container Images"
needs:
- ci
runs-on: ubuntu-latest
timeout-minutes: 20

Expand All @@ -38,15 +28,17 @@ jobs:
with:
dockerfile: docker/Dockerfile
target: cmservice
platforms: linux/amd64,linux/arm64
image: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
push: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && startsWith(github.ref_name, 'tickets/DM-')) }}
push: true

- uses: lsst-sqre/build-and-push-to-ghcr@v1
id: build-worker
with:
dockerfile: docker/Dockerfile
target: cmworker
platforms: linux/amd64,linux/arm64
image: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
push: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && startsWith(github.ref_name, 'tickets/DM-')) }}
push: true
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# and when called from another workflow.
---
name: "CI"

"on":
workflow_call:
push:
Expand All @@ -13,6 +14,10 @@ env:
UV_FROZEN: "1"

jobs:
rebase-checker:
uses:
./.github/workflows/rebase_checker.yaml

lint:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -75,3 +80,7 @@ jobs:

- name: Run tests
run: uv run make typing

build-and-push:
if: ${{ startsWith(github.ref_name, 'tickets/DM-') }}
uses: ./.github/workflows/build_and_push.yaml
3 changes: 2 additions & 1 deletion .github/workflows/rebase_checker.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
name: Rebase Checker

on: pull_request
"on":
workflow_call:

jobs:
call-workflow:
Expand Down
4 changes: 2 additions & 2 deletions src/lsst/cmservice/client/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from __future__ import annotations

from datetime import datetime, timedelta
from time import sleep
from typing import TYPE_CHECKING

import httpx
import pause
from pydantic import TypeAdapter, ValidationError

from .. import db, models
Expand Down Expand Up @@ -133,7 +133,7 @@ def pause_until_next_check(
# In unit tests we set queue.interval to zero
# so don't ever get to these lines
print("pausing")
pause.until(next_check)
sleep(sleep_time)

def daemon(
self,
Expand Down
4 changes: 1 addition & 3 deletions src/lsst/cmservice/handlers/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ async def _write_script(
pass

# build up the bps wrapper script
command = (
f"{config.bps.bps_bin} --log-file {json_url} --no-log-tty submit " f"{config_path} > {log_url}"
)
command = f"{config.bps.bps_bin} --log-file {json_url} --no-log-tty submit {config_path} > {log_url}"

prepend = bps_core_script_template_.data["text"].replace("{lsst_version}", lsst_version) # type: ignore
prepend = prepend.replace("{lsst_distrib_dir}", lsst_distrib_dir)
Expand Down
25 changes: 5 additions & 20 deletions tests/cli/util_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,7 @@ def check_update_methods(
) -> None:
result = runner.invoke(
client_top,
f"{entry_class_name} update data_dict "
"--output yaml "
f"--row_id {entry.id} "
"--update_dict test:dummy",
f"{entry_class_name} update data_dict --output yaml --row_id {entry.id} --update_dict test:dummy",
)
check = check_and_parse_result(result, dict)
assert check["test"] == "dummy", "update_data_dict failed"
Expand All @@ -267,10 +264,7 @@ def check_update_methods(

result = runner.invoke(
client_top,
f"{entry_class_name} update collections "
"--output yaml "
f"--row_id {entry.id} "
"--update_dict test:dummy",
f"{entry_class_name} update collections --output yaml --row_id {entry.id} --update_dict test:dummy",
)
check = check_and_parse_result(result, dict)
assert check["test"] == "dummy", "update_collections failed"
Expand Down Expand Up @@ -303,20 +297,14 @@ def check_update_methods(

result = runner.invoke(
client_top,
f"{entry_class_name} update child_config "
f"--row_id {entry.id} "
"--output yaml "
"--update_dict test:dummy",
f"{entry_class_name} update child_config --row_id {entry.id} --output yaml --update_dict test:dummy",
)
check = check_and_parse_result(result, dict)
assert check["test"] == "dummy", "update_child_config failed"

result = runner.invoke(
client_top,
f"{entry_class_name} update child_config "
f"--row_id -1 "
"--output yaml "
"--update_dict test:dummy",
f"{entry_class_name} update child_config --row_id -1 --output yaml --update_dict test:dummy",
)
expect_failed_result(result, 1)

Expand All @@ -331,10 +319,7 @@ def check_update_methods(

result = runner.invoke(
client_top,
f"{entry_class_name} update spec_aliases "
"--output yaml "
f"--row_id {entry.id} "
"--update_dict test:dummy",
f"{entry_class_name} update spec_aliases --output yaml --row_id {entry.id} --update_dict test:dummy",
)
# FIXME: is this the return type we want?
check_spec = check_and_parse_result(result, entry_class)
Expand Down
12 changes: 6 additions & 6 deletions tests/db/test_pipetask_error_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ async def test_error_match_db(engine: AsyncEngine) -> None:
# Here we test that the same error with a different pipetask name will
# not match. Let's consider the same error, but on task "isr"

assert (
e1.match("isr", known_error["diagnostic_message"]) is False
), "Failure to identify non-matching pipetask name"
assert e1.match("isr", known_error["diagnostic_message"]) is False, (
"Failure to identify non-matching pipetask name"
)

# Here we test that the same pipetask name but different error does not
# match.
assert (
e1.match(known_error["task_name"], "A different error message") is False
), "Failure to identify separate errors with the same associated pipetask"
assert e1.match(known_error["task_name"], "A different error message") is False, (
"Failure to identify separate errors with the same associated pipetask"
)

# Here we test that a different valid PipetaskError does not match to
# the wrong PipetaskErrorType
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4935ef1

Please sign in to comment.