Skip to content

Input order of a task is now sorted according to the order of definition of the connections#251

Merged
gbin merged 3 commits into
copper-project:masterfrom
hscoelho:task-input-order
Mar 5, 2025
Merged

Input order of a task is now sorted according to the order of definition of the connections#251
gbin merged 3 commits into
copper-project:masterfrom
hscoelho:task-input-order

Conversation

@hscoelho

@hscoelho hscoelho commented Mar 5, 2025

Copy link
Copy Markdown
Contributor

fixes #187

Took me a while, but finally got some time to work on this 😅.

I'm pretty confident this solution doesn´t affect other parts of the runtime unexpectedly, since it only mutates the input_msg_indices_types object, but I have made some assumptions to actually obtain the id used to sort and I decided panicking would be more appropriate than having a fallback option, so I'm a little worried there's an edge case I'm not aware that might break this solution. (I did test with the examples though).

The reason I created two unit tests was to make sure this works both with a config file and programmatically.

hscoelho added 3 commits March 4, 2025 22:25
this was done to make sure the edge ids in the graph depend on the order the cnx are added in the ron config
since this is true, this can be used to sort the input order according to the cnx order
Previously, the input order of a tasks was sorted according to the order
in which the input nodes are created in the runtime plan(which means
that it was related to the order the nodes were defined in the config
file).
Now, the input order of a task is related to the order of the
connections in the cnx array in the config file.
The inputs are actually sorted according to the edge id in the config
graph, that is assigned whenever an edge is created. Since the edges are
created in the same order as the cnx array(or when a connection is
created programatically), sorting by the edge id achieves the desired
behaviour.
@gbin

gbin commented Mar 5, 2025

Copy link
Copy Markdown
Collaborator

fantastic! I'll take a look tomorrow morning

@gbin gbin self-requested a review March 5, 2025 01:54

@gbin gbin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is really good, thanks! I'll merge that and I'll beta test on my project right away.

@gbin gbin merged commit 6c45e98 into copper-project:master Mar 5, 2025
@hscoelho hscoelho deleted the task-input-order branch March 10, 2025 02:49
@makeecat makeecat added the bug Something isn't working label Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The order of the tuples on a task getting inputs from other tasks depends on Copper's internal scheduling

3 participants