Skip to content

[desc] Execute pre & post process in the farm#2984

Open
Alxiice wants to merge 7 commits intodevelopfrom
dev/pre_and_post_process_in_farm
Open

[desc] Execute pre & post process in the farm#2984
Alxiice wants to merge 7 commits intodevelopfrom
dev/pre_and_post_process_in_farm

Conversation

@Alxiice
Copy link
Contributor

@Alxiice Alxiice commented Jan 21, 2026

PR description

We introduce a new feature that enables preprocessing and postprocessing tasks.
In this new version, these tasks are considered as new chunks and can be implemented on custom nodes.
On the scheduling/submitter part, preprocessing are executed before all chunks, and postprocessing are executed after them.
This way these can be used to prepare data for processing in chunks (preprocessing), and then concatenate data from all chunks (postprocessing).

Adding preprocessing/postprocessing tasks

It's very simple and follows what we already use with process/processChunk

class PluginSubmitterDPrePost(desc.Node):
    category = 'MyPlugins'
    inputs = INPUTS
    outputs = OUTPUTS

    def preprocess(self, node):
        LOGGER.info(f"> [{node.name}](preprocess) Start")
        # TODO
        LOGGER.info(f"> [{node.name}](preprocess) Done")

    def postprocess(self, node):
        LOGGER.info(f"> [{node.name}](postprocess) Start")
        # TODO
        LOGGER.info(f"> [{node.name}](postprocess) Done")

Impact on the UI

image

If there no preprocess/postprocess the chunks will not be displayed on the UI.

Implementation notes

  • Create a add_method_flag decorator to be able to check whether a method is overloaded or not. preprocess and postprocess methods are flagged with it, and we know if we have a pre/postprocess using this system
  • On the submitter part a new task graph system is introduced to rebuild the list of tasks. This way when we get to the submitter it's extremely simple to send tasks to the submitter.

Note to the reviewers

  • Check the name of classes (Ordered...) on the submitter

Merging

  • First a PR to make sure nothing is changes on the submitter side : mrSubmitters/4
  • Then this PR
  • Finally a PR on the submitter side to use the new API : TODO

@Alxiice Alxiice marked this pull request as draft January 21, 2026 17:32
@Alxiice Alxiice self-assigned this Jan 21, 2026
@Alxiice Alxiice requested a review from cbentejac January 21, 2026 17:32
@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 82.54310% with 81 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.02%. Comparing base (74fb0ca) to head (9dddaa9).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
meshroom/core/node.py 65.03% 50 Missing ⚠️
meshroom/core/submitter.py 87.65% 20 Missing ⚠️
meshroom/core/desc/node.py 54.54% 5 Missing ⚠️
...lugins/meshroom/pluginSubmitter/PluginSubmitter.py 62.50% 3 Missing ⚠️
tests/test_submit.py 96.72% 2 Missing ⚠️
tests/test_compute.py 98.70% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2984      +/-   ##
===========================================
+ Coverage    81.99%   82.02%   +0.03%     
===========================================
  Files           69       69              
  Lines         9315     9688     +373     
===========================================
+ Hits          7638     7947     +309     
- Misses        1677     1741      +64     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces preprocessing and postprocessing capabilities to Meshroom's node execution system. These new stages allow nodes to perform setup work before chunk processing and cleanup/aggregation work after all chunks complete. The implementation treats pre/post-processing as special chunks with dedicated indices, integrates them into the task submission system, and updates the UI to display these stages.

Changes:

  • Added ChunkIndex enum to distinguish preprocess (-2), postprocess (-1), and standard chunks (0+)
  • Implemented task ordering system (OrderedTasks, OrderedTask, OrderedNode) to schedule pre/post-processing relative to chunks
  • Updated UI (QML) to display preprocess/postprocess chunks in the chunks list view

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
meshroom/core/desc/node.py Added add_method_flag decorator to detect overridden preprocess/postprocess methods
meshroom/core/node.py Implemented ChunkIndex enum, created pre/post-process chunks, updated chunk processing logic
meshroom/core/submitter.py Added OrderedTask/OrderedNode/OrderedTasks classes for task dependency ordering
meshroom/core/taskManager.py Updated to pass forceCompute to pre/postprocess calls
meshroom/core/graph.py Added debug print statements for graph execution (should be removed)
meshroom/ui/qml/Utils/Colors.qml Added null check for chunk color handling
meshroom/ui/qml/GraphEditor/NodeLog.qml Simplified chunk log file access
meshroom/ui/qml/GraphEditor/NodeEditor.qml Changed to use allChunks property, increased width for "postprocess" text
meshroom/ui/qml/GraphEditor/ChunksListView.qml Refactored to handle pre/postprocess chunks with ChunkIndex enum
bin/meshroom_compute Added --preprocess and --postprocess flags, updated chunk iteration handling
bin/meshroom_createChunks Moved preprocess/postprocess calls outside chunk loop
localfarm/localFarm.py Improved logging format
localfarm/README.md Added comprehensive documentation for local farm (contains typo: "famr")
tests/test_submit.py Added test_orderTasks to verify task ordering logic
tests/test_compute.py Updated to call pre/postprocess outside chunk loop, added duplicate prepareLogger call
tests/plugins/meshroom/pluginSubmitter/PluginSubmitter.py Updated test plugins to demonstrate pre/postprocess usage
Comments suppressed due to low confidence (4)

localfarm/README.md:8

  • Spelling error: "famr" should be "farm"
> Note that the local famr only works in Unix for now because we use `fork` for daemonization.

meshroom/core/submitter.py:76

  • The comment for EXPANDING is identical to PREPROCESS. It should describe that this task executes a node's expanding process (for nodes whose chunk count is not determined yet).
    EXPANDING = auto()
    """Task that executes a node preprocess method"""

meshroom/core/submitter.py:78

  • The comment for CHUNK is misleading. Based on the code context, CHUNK represents a task that executes a single chunk of a parallelized node, not a task that will expand. The "expanding" behavior is handled by the EXPANDING task type.
    CHUNK = auto()
    """Task that will expand during the processing"""

meshroom/core/submitter.py:184

  • Spelling error in documentation: "orger" should be "order"
        Take all the nodes and connections and orger them by processing step

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@servantftransperfect servantftransperfect left a comment

Choose a reason for hiding this comment

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

Can't you use simple introspection ?

is_overridden = type(self).preprocess is not Node.preprocess

not sure of the grammar

@Alxiice Alxiice force-pushed the dev/pre_and_post_process_in_farm branch from ec321ae to 9dddaa9 Compare February 27, 2026 18:38
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.

4 participants