Skip to content

Commit

Permalink
Merge branch 'master' into fix-enum-spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
seallard committed Nov 10, 2023
2 parents a14338e + 7297e83 commit 14c92f7
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 19.0.1
current_version = 19.0.2
commit = True
tag = True
tag_name = {new_version}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def parse_reqs(req_path="./requirements.txt"):

setup(
name=NAME,
version="19.0.1",
version="19.0.2",
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion tests/mocks/store_mock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from trailblazer.store.api import Store
from trailblazer.store.core import Store


class MockStore(Store):
Expand Down
6 changes: 3 additions & 3 deletions tests/store/utils/store_helper.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Utility functions to simply add test data in a Trailblazer store."""
from datetime import datetime, date
from datetime import date, datetime

from trailblazer.store.api import Store
from trailblazer.store.models import Info, User, Job
from trailblazer.store.core import Store
from trailblazer.store.models import Info, Job, User


class StoreHelpers:
Expand Down
2 changes: 1 addition & 1 deletion trailblazer/cli/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from trailblazer.environ import environ_email
from trailblazer.io.controller import ReadFile
from trailblazer.models import Config
from trailblazer.store.api import Store
from trailblazer.store.core import Store
from trailblazer.store.models import Analysis, User

LOG = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions trailblazer/server/ext.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from flask_alchy import Alchy

from trailblazer.store.api import BaseHandler
from trailblazer.store.core import CoreHandler
from trailblazer.store.models import Model


class TrailblazerAlchy(Alchy, BaseHandler):
class TrailblazerAlchy(Alchy, CoreHandler):
pass


Expand Down
19 changes: 0 additions & 19 deletions trailblazer/store/api.py

This file was deleted.

5 changes: 4 additions & 1 deletion trailblazer/store/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@


@dataclass
class BaseHandler_2:
class BaseHandler:
"""All models in one base class."""

def __init__(self):
pass

def setup(self):
self.create_all()

def get_query(self, table: Type[Model]) -> Query:
"""Return a query for the given table."""
return self.query(table)
Expand Down
8 changes: 8 additions & 0 deletions trailblazer/store/core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import alchy

from trailblazer.store.crud.create import CreateHandler
from trailblazer.store.crud.delete import DeleteHandler
from trailblazer.store.crud.read import ReadHandler
from trailblazer.store.crud.update import UpdateHandler
from trailblazer.store.models import Model


class CoreHandler(
Expand All @@ -14,3 +17,8 @@ class CoreHandler(

def __init__(self):
pass


class Store(alchy.Manager, CoreHandler):
def __init__(self, uri: str):
super(Store, self).__init__(config=dict(SQLALCHEMY_DATABASE_URI=uri), Model=Model)
4 changes: 2 additions & 2 deletions trailblazer/store/crud/create.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from datetime import datetime

from trailblazer.constants import TrailblazerStatus
from trailblazer.store.base import BaseHandler_2
from trailblazer.store.base import BaseHandler
from trailblazer.store.models import Analysis, User


class CreateHandler(BaseHandler_2):
class CreateHandler(BaseHandler):
"""Class for creating items in the database."""

def add_pending_analysis(
Expand Down
4 changes: 2 additions & 2 deletions trailblazer/store/crud/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

from trailblazer.constants import TrailblazerStatus
from trailblazer.exc import MissingAnalysis, TrailblazerError
from trailblazer.store.base import BaseHandler_2
from trailblazer.store.base import BaseHandler
from trailblazer.store.models import Analysis

LOG = logging.getLogger(__name__)


class DeleteHandler(BaseHandler_2):
class DeleteHandler(BaseHandler):
"""Class for deleting items in the database."""

def delete_analysis_jobs(self, analysis: Analysis) -> None:
Expand Down
4 changes: 2 additions & 2 deletions trailblazer/store/crud/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy.orm import Query

from trailblazer.constants import TrailblazerStatus
from trailblazer.store.base import BaseHandler_2
from trailblazer.store.base import BaseHandler
from trailblazer.store.filters.analyses_filters import (
AnalysisFilter,
apply_analysis_filter,
Expand All @@ -15,7 +15,7 @@
from trailblazer.store.models import Analysis, Job, User


class ReadHandler(BaseHandler_2):
class ReadHandler(BaseHandler):
"""Class for reading items in the database."""

def get_nr_jobs_with_status_per_category(
Expand Down
4 changes: 2 additions & 2 deletions trailblazer/store/crud/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
from trailblazer.apps.tower.api import TowerAPI, get_tower_api
from trailblazer.constants import SlurmJobStatus, TrailblazerStatus, WorkflowManager
from trailblazer.exc import MissingAnalysis, TrailblazerError
from trailblazer.store.base import BaseHandler_2
from trailblazer.store.base import BaseHandler
from trailblazer.store.models import Analysis, Job, User

LOG = logging.getLogger(__name__)


class UpdateHandler(BaseHandler_2):
class UpdateHandler(BaseHandler):
"""Class for updating items in the database."""

def update_analysis_jobs(self, analysis: Analysis, jobs: List[dict]) -> None:
Expand Down

0 comments on commit 14c92f7

Please sign in to comment.