Skip to content

Commit

Permalink
service: raise when calling not implemented methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ntarocco committed Jul 10, 2024
1 parent e4749f4 commit 5c7780e
Showing 1 changed file with 67 additions and 3 deletions.
70 changes: 67 additions & 3 deletions invenio_jobs/services/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,71 @@
from .errors import JobNotFoundError, RunNotFoundError, RunStatusChangeError


class TasksService(RecordService):
class OnlySearchRecordService(RecordService):
"""Base service class that allows only searching.
Needed because this module does not have records, but re-implements the search
method from the record's service and uses the permissions mechanism.
"""

def check_revision_id(self):
"""Not implemented."""
raise NotImplementedError()

def create_search(self):
"""Not implemented."""
raise NotImplementedError()

def search_request(self):
"""Not implemented."""
raise NotImplementedError()

def scan(self):
"""Not implemented."""
raise NotImplementedError()

def reindex(self):
"""Not implemented."""
raise NotImplementedError()

def create(self):
"""Not implemented."""
raise NotImplementedError()

def read(self):
"""Not implemented."""
raise NotImplementedError()

def exists(self):
"""Not implemented."""
raise NotImplementedError()

def read_many(self):
"""Not implemented."""
raise NotImplementedError()

def read_all(self):
"""Not implemented."""
raise NotImplementedError()

def update(self):
"""Not implemented."""
raise NotImplementedError()

def delete(self):
"""Not implemented."""
raise NotImplementedError()

def rebuild_index(self):
"""Not implemented."""
raise NotImplementedError()

def on_relation_update(self):
"""Not implemented."""
raise NotImplementedError()


class TasksService(OnlySearchRecordService):
"""Tasks service."""

def search(self, identity, params):
Expand Down Expand Up @@ -78,7 +142,7 @@ def get_run(run_id, job_id=None):
return run


class JobsService(RecordService):
class JobsService(OnlySearchRecordService):
"""Jobs service."""

@unit_of_work()
Expand Down Expand Up @@ -173,7 +237,7 @@ def delete(self, identity, id_, uow=None):
return True


class RunsService(RecordService):
class RunsService(OnlySearchRecordService):
"""Runs service."""

def search(self, identity, job_id, params):
Expand Down

0 comments on commit 5c7780e

Please sign in to comment.