Page MenuHomePhabricator

[jobs-api] Split the core layer and create the core models
Closed, ResolvedPublic

Description

This means creating a new module (core) inside tjf with all the business models and logic, similar to the API one in structure.

We might want to create a Core interface class with all the methods that the api module will use (similar strategy than with storage or runtime, but no need for abstract class for this one). This should be created at startup time (app.py) and stored in the app object.

It should accept the storage and runtime as init parameters, and we should stop using them directly on the api module, and call the Core methods instead (api should not be aware of a storage or runtime, just core). For example:

# app.py

def create_app(...):
   ...
   my_core = Core(storage=Storage(), runtime=Runtime())
   ...


# ex. jobs_handlers.py

def create_job(app, new_job: NewJob, tool_name: str, ...) -> DefinedJob:
    ...
    gotten_job = DefinedJob.from_job(app.core.create_job(job=new_job.to_job(), tool_name=tool_name)
    return gotten_job

Related Objects

StatusSubtypeAssignedTask
ResolvedLucasWerkmeister
Resolvedmatmarex
ResolvedLegoktm
ResolvedLegoktm
In Progressdcaro
Resolveddcaro
In Progresskomla
Resolveddcaro
Resolveddcaro
ResolvedRaymond_Ndibe
Opendcaro
OpenNone
In ProgressFeatureRaymond_Ndibe
ResolvedFeatureRaymond_Ndibe
OpenRaymond_Ndibe
ResolvedRaymond_Ndibe
ResolvedRaymond_Ndibe

Event Timeline

dcaro triaged this task as High priority.
Raymond_Ndibe changed the task status from Open to In Progress.Apr 8 2025, 3:28 AM

group_203_bot_4866fc124f4b41659f667468a6115cf3 opened https://gitlab.wikimedia.org/repos/cloud/toolforge/toolforge-deploy/-/merge_requests/742

jobs-api: bump to 0.0.365-20250409092629-77469f38