Skip to content
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

Add Resources Service & Processors #3959

Open
HyeockJinKim opened this issue Mar 12, 2025 — with Lablup-Issue-Syncer · 0 comments
Open

Add Resources Service & Processors #3959

HyeockJinKim opened this issue Mar 12, 2025 — with Lablup-Issue-Syncer · 0 comments
Assignees

Comments

@HyeockJinKim
Copy link
Collaborator

User story

  • As a developer, when I implement the VFolder service, I want to move actions from the VFolder handlers to the service so that the code is cleaner and more maintainable.
  • As a developer, when I define actions in the decorator, I want to ensure they are implemented as service actions or validators so that they follow the correct structure.

Context

This issue involves defining the VFolder service and processors for handling VFolder-related actions. The goal is to simplify the current implementation by moving actions from the handlers to the service without changing the existing code.

Acceptance criteria

  • Move actions from VFolder-related handlers to the VFolder service.
  • Define actions in the decorator as service actions or validators.
  • Implement service action methods using input and result values that inherit from BaseAction and BaseActionResult classes.
  • Each service must be implemented as a class.
  • Maintain the existing connection with the root context.
  • No changes to the code other than moving to the service.

Other information

Concept code provided:

class VFolderService:
    async def create_vfolder(self, action: VFolderAction) -> VFolderActionResult: ...

    async def destroy_vfolder(self, action: VFolderAction) -> VFolderActionResult: ...

svc = VFolderService()

class VFolderProcessors:
    create: ActionProcessor[VFolderAction, VFolderActionResult]
    destroy: ActionProcessor[VFolderAction, VFolderActionResult]
    ...

    def __init__(self, monitors: list[ActionMonitor]) -> None:
        self.create = ActionProcessor(svc.create_vfolder, monitors=monitors, rollbacks=[...])
        self.destroy = ActionProcessor(svc.destroy_vfolder, monitors=monitors)

p = VFolderProcessors(monitors=[])


async def create_handler():
    act = VFolderAction(...)
    res = await p.create.wait_for_complete(act)
    return res.to_response()
@HyeockJinKim HyeockJinKim changed the title Add resource Service & Processors Add Resources Service & Processors Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants