Skip to content

Conversation

@myxie
Copy link
Collaborator

@myxie myxie commented Jul 25, 2025

JIRA Ticket

Type

  • Feature (addition)
  • Bug fix
  • Refactor (change)
  • Documentation

Problem/Issue

Solution

Checklist

  • Unittests added
    • Reason for not adding unittests (remove this line if added)
  • Documentation added
    • Reason for not adding documentation (remove this line if added)

Summary by Sourcery

Migrate simple built-in DALiuGE applications from custom BarrierAppDROP subclasses to function-based PyFuncApp definitions, refactor the Branch app accordingly, adjust drop loader behavior for empty inputs, and update tests to exercise the new PyFuncApp APIs

New Features:

  • Introduce PyFuncApp-based simple apps: sleep, hello_world, random_array, retrieve_url, and list_thrashing functions

Bug Fixes:

  • Ensure load_dill returns None instead of failing when reading empty data

Enhancements:

  • Migrate SleepAndCopyApp to invoke the new sleep function
  • Refactor Branch application to use PyFuncApp style with write_results logic
  • Remove legacy BarrierAppDROP subclasses for simple apps and replace with function-based implementations

Tests:

  • Update tests to instantiate and validate PyFuncApp instances and adjust serialization/assertions for new function outputs

myxie added 2 commits July 23, 2025 15:40
This deletes lots of code and makes it easier to drop them in-place.

Signed-off-by: Ryan Bunney <[email protected]>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 25, 2025

Reviewer's Guide

This PR migrates simple DALiuGE applications to pure PyFuncApps, refactors the branch app implementation accordingly, updates the corresponding tests to leverage the new functions, and enhances drop loader resilience.

Class diagram for refactored simple DALiuGE Apps to PyFuncApps

classDiagram
    class BarrierAppDROP
    class CopyApp
    class PyFuncApp

    %% Removed classes
    class SleepApp
    class RandomArrayApp
    class HelloWorldApp
    class UrlRetrieveApp
    class ListAppendThrashingApp
    class BranchAppDrop

    %% New/Refactored classes and functions
    class SleepAndCopyApp {
        +float sleep_time
        +run()
    }
    class Branch {
        +int bufsize
        +bool result
        +write_results(result: bool)
    }
    %% PyFunc-based functions
    class sleep {
        +sleep_time: float
    }
    class hello_world {
        +greet: str
    }
    class random_array {
        +low: float
        +high: float
        +size: int
        +integer: bool
        +seed: int
    }
    class retrieve_url {
        +url: str
    }
    class list_thrashing {
        +n: int
    }

    %% Inheritance
    SleepAndCopyApp --|> CopyApp
    Branch --|> PyFuncApp

    %% Removed classes inheritances (for context)
    SleepApp --|> BarrierAppDROP
    RandomArrayApp --|> BarrierAppDROP
    HelloWorldApp --|> BarrierAppDROP
    UrlRetrieveApp --|> BarrierAppDROP
    ListAppendThrashingApp --|> BarrierAppDROP
    BranchAppDrop --|> BarrierAppDROP

    %% Indicate that PyFuncApps are now functions, not classes
    sleep ..> PyFuncApp : now a function
    hello_world ..> PyFuncApp : now a function
    random_array ..> PyFuncApp : now a function
    retrieve_url ..> PyFuncApp : now a function
    list_thrashing ..> PyFuncApp : now a function
Loading

Class diagram for refactored Branch app (branch.py)

classDiagram
    class PyFuncApp
    class Branch {
        +int bufsize
        +bool result
        +write_results(result: bool)
    }
    Branch --|> PyFuncApp

    %% Removed class
    class BranchAppDrop
    BranchAppDrop --|> BarrierAppDROP

    %% Note: BranchAppDrop replaced by Branch(PyFuncApp)
Loading

File-Level Changes

Change Details Files
Migrate simple DALiuGEApp classes to PyFuncApp functions
  • Removed multiple BarrierAppDROP subclasses (SleepApp, HelloWorldApp, RandomArrayApp, UrlRetrieveApp, ListAppendThrashingApp).
  • Introduced functions: sleep, hello_world, random_array, retrieve_url, list_thrashing with PyFuncApp metadata.
  • Updated SleepAndCopyApp to use new sleep() function and dlg_float_param for parameters.
daliuge-engine/dlg/apps/simple.py
Refactor branch application to use PyFuncApp
  • Replaced BranchAppDrop and SimpleBranch classes with a single Branch class inheriting PyFuncApp.
  • Imported PyFuncApp and dlg meta parameter decorators, updated license header.
  • Consolidated write_results logic and parameter definitions (bufsize, result).
daliuge-engine/dlg/apps/branch.py
Update tests to use PyFuncApp for simple apps and adjust assertions
  • Swapped SleepApp, RandomArrayApp, HelloWorldApp, ListAppendThrashingApp instantiations for PyFuncApp calls.
  • Adjusted test logic: set numpy seed, switch to dill.loads for outputs, updated timeouts.
  • Revised input definitions and output assertions to match new function signatures.
daliuge-engine/test/apps/test_simple.py
Improve drop_loaders.load_dill to handle empty buffers
  • Added guard to only call dill.loads when buffer contains data.
  • Return None when no data is read to avoid exceptions.
daliuge-engine/dlg/drop_loaders.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

- Still need to fix unittests by updating existing graphs.

Signed-off-by: Ryan Bunney <[email protected]>
import logging
import time
import numpy as np
# from tests.data.example_eagle import RandomArrayApp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doxygen comments for the new functions are not required at all and we should remove them. However, we might then want to move all the functions into the simple_functions.py file and just leave the real Apps in here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they still need to be there because otherwise the dlg_paletteGen won't parse them for the EAGLE palettes (from what I understand, this is what the tag: daliuge is for).

@myxie myxie changed the title LIU-455: Move the simple DALiuGEApps to simple PyFuncApps (WIP) LIU-455: Move the simple DALiuGEApps to simple PyFuncApps Aug 6, 2025
@myxie
Copy link
Collaborator Author

myxie commented Aug 6, 2025

@awicenec this PR is still marked as a draft and has been put on hold, so don't worry about giving it any in-depth review for the time being.

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

Successfully merging this pull request may close these issues.

3 participants