Page MenuHomeSoftware Heritage

Introduce a SchedulerException base class
ClosedPublic

Authored by olasd on Jun 15 2020, 3:00 PM.

Details

Summary

This allows us to automatically serialize/deserialize exceptions under this base
class within our RPC framework.

Depends on D3270.

Test Plan

mostly used by diffs above this one.

Diff Detail

Repository
rDSCH Scheduling utilities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D3283 (id=11643)

Could not rebase; Attempt merge onto 4c0c37bab0...

Updating 4c0c37b..466ac59
Fast-forward
 requirements.txt                  |  1 +
 swh/scheduler/api/client.py       |  7 ++++
 swh/scheduler/api/serializers.py  | 28 ++++++++++++++
 swh/scheduler/api/server.py       | 10 ++++-
 swh/scheduler/exc.py              | 12 ++++++
 swh/scheduler/model.py            | 57 +++++++++++++++++++++++++++++
 swh/scheduler/tests/test_model.py | 77 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 191 insertions(+), 1 deletion(-)
 create mode 100644 swh/scheduler/api/serializers.py
 create mode 100644 swh/scheduler/exc.py
 create mode 100644 swh/scheduler/model.py
 create mode 100644 swh/scheduler/tests/test_model.py
Changes applied before test
commit 466ac5912e347b9b2da4254849b2d3192819fd2a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Mon Jun 15 14:46:28 2020 +0200

    Introduce a SchedulerException base class
    
    This allows us to automatically serialize/deserialize exceptions under this base
    class within our RPC framework.

commit c509a12df5f1c25be3e492c693be11eae382862a
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Fri Jun 12 11:03:26 2020 +0200

    Introduce some scaffolding for an attrs-based BaseSchedulerModel
    
    Alongside swh.model.model, this allows us to define data models for the objects
    the scheduler is working with, and to serialize/deserialize these objects
    transparently at the RPC layer.
    
    This also introduces some mild ORM-like logic so we can keep the actual SQL a
    little DRYer.

See https://jenkins.softwareheritage.org/job/DSCH/job/tests-on-diff/25/ for more details.

douardda added a subscriber: douardda.

not completely sure why this is necessary, but meh

This revision is now accepted and ready to land.Jun 15 2020, 4:16 PM

not completely sure why this is necessary, but meh

The default RPC Client exception handling will wrap remote exceptions with a RemoteAPIException; this lets us pass through some explicit exceptions for stuff that /we/ control.

This revision was automatically updated to reflect the committed changes.