chore: refactor handling of the actual dataflow#464
chore: refactor handling of the actual dataflow#464doudou wants to merge 2 commits intotransition-to-runkitfrom
Conversation
This is preparation work to prepare a change in how the actual dataflow graph manages its internal data. The objective of this commit is to make an interface that hides these details to the rest of Syskit
75f8fa1 to
42d7f4c
Compare
| .edge_info(source_task.orocos_task, orocos_task) | ||
| .key?([source_port, sink_port]) | ||
| Runtime::ActualDataFlow.ports_connected?( | ||
| source_task.orocos_task, source_port, orocos_task, sink_port |
There was a problem hiding this comment.
I can't see from where orocos_task is from. Neither in this refactor or in the old code
| # @param [Orocos::TaskContext] sink_task | ||
| # @return [{[String,String] => Hash}] mapping of (source_port,sink_port) pairs | ||
| # to the policy of the established connection | ||
| def connections_of_tasks(source_task, sink_task) |
There was a problem hiding this comment.
If this isn't a heterogeneous graph, I would go with just def connections(source_task, sink_task)
| # @return [{[Orocos::Task,Orocos::Task] => Array<[String,String]>}] matching | ||
| # connections, as a mapping of (source_task, sink_task) to the port | ||
| # pair (as names) | ||
| def input_connections_of_ports(orocos_task, port_names) |
There was a problem hiding this comment.
def inputs_for(orocos_task, port_names)
| # @return [{[Orocos::Task,Orocos::Task] => Array<[String,String]>}] matching | ||
| # connections, as a mapping of (source_task, sink_task) to the port | ||
| # pair (as names) | ||
| def output_connections_of_task(orocos_task) |
There was a problem hiding this comment.
This is the reason of these '_of_task' and 'of_ports'
The input_connections is of_ports, that is is restricted to some ports.
This gives all outputs of a given task. There's actually output_connections_of_ports that restricts to ports. I think not specifying it on all methods would be confusing.
| def input_connections_of_ports(orocos_task, port_names) | ||
| @graph.each_in_neighbour(orocos_task) | ||
| .with_object({}) do |source_t, result| | ||
| mappings = @graph.edge_info(source_t, orocos_task) |
There was a problem hiding this comment.
At static_input_port_connections you called the return of @graph_edge_info connections, I like it better than mappings which I think is innocuous
connections = @graph.edge_info(source_t, orocos_task)
This PR's objective is to cleanup the ActualDataFlow graph so that it's easier to change. One main change is that the graph is now not directly available anymore, as it was, so that the rest of the runtime code is not directly dependent on the graph structure.