-
Notifications
You must be signed in to change notification settings - Fork 4
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
Report model and DataStore failure modes #268
Changes from 12 commits
3939bfd
b286fbb
9016133
060ea82
7cd3ef0
71101d5
aead6eb
42cb674
a7128dc
dce797f
c269863
a22a712
d51031d
83bd122
49b5135
c767028
2ac7ee7
7c607a2
8e63a0b
679db26
78b484a
709af1b
1580c26
8178176
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Run Model Tests 2 | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
name: run tests in docker image | ||
runs-on: ubuntu-latest | ||
env: | ||
REGISTRY: ghcr.io | ||
COMPOSE_FILE: tests/docker-compose.yaml | ||
|
||
steps: | ||
- name: Dump docker logs on failure | ||
if: failure() | ||
uses: jwalton/gh-docker-logs@v2 | ||
|
||
- name: checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: log into github container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: setup docker buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver: docker-container | ||
|
||
- name: bake | ||
uses: docker/[email protected] | ||
with: | ||
workdir: tests | ||
load: true | ||
files: docker-compose.yaml | ||
set: | | ||
seechange_postgres.tags=ghcr.io/${{ github.repository_owner }}/seechange-postgres | ||
seechange_postgres.cache-from=type=gha,scope=cached-seechange-postgres | ||
seechange_postgres.cache-to=type=gha,scope=cached-seechange-postgres,mode=max | ||
setuptables.tags=ghcr.io/${{ github.repository_owner }}/runtests | ||
setuptables.cache-from=type=gha,scope=cached-seechange | ||
setuptables.cache-to=type=gha,scope=cached-seechange,mode=max | ||
runtests.tags=ghcr.io/${{ github.repository_owner }}/runtests | ||
runtests.cache-from=type=gha,scope=cached-seechange | ||
runtests.cache-to=type=gha,scope=cached-seechange,mode=max | ||
shell.tags=ghcr.io/${{ github.repository_owner }}/runtests | ||
shell.cache-from=type=gha,scope=cached-seechange | ||
shell.cache-to=type=gha,scope=cached-seechange,mode=max | ||
|
||
- name: run test | ||
run: | | ||
shopt -s nullglob | ||
TEST_SUBFOLDER=$(ls tests/models/test_{m..z}*.py) docker compose run runtests |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""reference instrument | ||
|
||
Revision ID: 9a4097979249 | ||
Revises: 485334f16c23 | ||
Create Date: 2024-05-22 11:22:20.322800 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '9a4097979249' | ||
down_revision = '485334f16c23' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('refs', sa.Column('instrument', sa.Text(), nullable=False)) | ||
op.create_index(op.f('ix_refs_instrument'), 'refs', ['instrument'], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f('ix_refs_instrument'), table_name='refs') | ||
op.drop_column('refs', 'instrument') | ||
# ### end Alembic commands ### |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ | |
from sqlalchemy import orm | ||
from sqlalchemy.dialects.postgresql import JSONB | ||
|
||
|
||
from models.base import Base, SeeChangeBase, AutoIDMixin, SmartSession, _logger | ||
from models.base import Base, SeeChangeBase, AutoIDMixin, SmartSession | ||
from models.enums_and_bitflags import ( | ||
bitflag_to_string, | ||
string_to_bitflag, | ||
|
@@ -14,6 +13,7 @@ | |
pipeline_products_inverse, | ||
) | ||
|
||
from util.logger import SCLogger | ||
|
||
class Report(Base, AutoIDMixin): | ||
"""A report on the status of analysis of one section from an Exposure. | ||
|
@@ -105,6 +105,14 @@ class Report(Base, AutoIDMixin): | |
) | ||
) | ||
|
||
cluster_id = sa.Column( | ||
sa.Text, | ||
nullable=True, | ||
doc=( | ||
"ID of the cluster where the worker/process ran this section. " | ||
) | ||
) | ||
|
||
error_step = sa.Column( | ||
sa.Text, | ||
nullable=True, | ||
|
@@ -311,7 +319,7 @@ def scan_datastore(self, ds, process_step, session=None): | |
if self.warnings is None or self.warnings == '': | ||
self.warnings = new_string | ||
else: | ||
self.warnings += ', ' + new_string | ||
self.warnings += '\n***|***|***\n' + new_string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I understand what you meant in that comment; I was confused at first, because I thought There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I didn't think I made it very clear. But I think this will be good. |
||
|
||
if exception is not None: | ||
self.error_type = exception.__class__.__name__ | ||
|
@@ -339,7 +347,7 @@ def read_warnings(process_step, warnings_list): | |
for w in warnings_list: | ||
text = f'{process_step}: {w.category} {w.message} ({w.filename}:{w.lineno})' | ||
formatted_warnings.append(text) | ||
_logger.warning(text) # make sure warnings also get printed to the log/on screen. | ||
SCLogger.warning(text) # make sure warnings also get printed to the log/on screen. | ||
|
||
warnings_list.clear() # remove all the warnings but keep the list object | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you envisioning that we'll keep these reports around forever, or that we'll sometimes clean the table out?
If we think of this as something mostly to keep track of what happened with recent processing, then fine. But, if we want to use this as a record of processing from a long time ago, I can see there starting to be problems identifying the right report rows.
For instance, if we've created images from exposures for more than one provenance, there will be multiple images for a given exposure/sensor section. Finding the right report row for a given image becomes challenging in that case. If we care about that, then we need to think about this.
(My instinct is that, at least for now, we say that the reports class is effectively a transitory table, for keeping track of what's happening with "current" processing.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the reports are only a way for things like the webapp to know what is going on. We can remove them periodically.
There could be multiple reports of the same image with the same provenance (if you had an error and restarted the pipeline).
We might decide we do want to keep a subset of the reports as way to mark which exposures have been "finished" but we would want to periodically prune the reports and leave (a) the correct provenance (b) the latest run that finished successfully. Then we'd have a checklist of what was successfully processed and stored. Or you can do that with a similar, smaller table that says something like StoredInDataRelease and only tells you which exposures were done (and maybe point you to the provenances that are relevant).