ff5bbede0431e5296811dc57432a33a9a68942d0,pysos/dag.py,SoS_DAG,build,#SoS_DAG#Any#,225

Before Change


        // refer to http://stackoverflow.com/questions/33494376/networkx-add-edges-to-graph-from-node-attributes
        //
        // for some code using attributes
        for node_i in self.nodes():
            for node_j in self.nodes():
                if node_i == node_j:
                    continue
                if node_i.depends_on(node_j):
                    self.add_edge(node_j, node_i)
                if node_j.depends_on(node_i):
                    self.add_edge(node_i, node_j)


    def write_dot(self, filename):
        try:
            nx.drawing.nx_pydot.write_dot(self, filename)
        except Exception as e:

After Change


        // refer to http://stackoverflow.com/questions/33494376/networkx-add-edges-to-graph-from-node-attributes
        //
        // several cases triggers dependency.
        indexed = [x for x in self.nodes() if x._node_index is not None]
        indexed.sort(key = lambda x: x._node_index)

        for idx, node in enumerate(indexed):
            // 1. if a node changes context (using option alias), all later steps
            // has to rely on it.
            if node._change_context:
                for later_node in indexed[idx + 1: ]:
                    self.add_edge(node, later_node)

            // 2. if the input of a step is undetermined, it has to be executed
            // after all its previous steps.
            if isinstance(node._input_targets, Undetermined) and idx > 0:
                self.add_edge(indexed[idx-1], node)
        //
        // 3. if the input of a step depends on the output of another step
        for target, in_node in self._all_dependent_files.items():
            for out_node in [y for (x,y) in self._all_output_files.items() if x == target]:
                for i in in_node:
                    for j in out_node:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: vatlab/SoS
Commit Name: ff5bbede0431e5296811dc57432a33a9a68942d0
Time: 2016-09-22
Author: ben.bog@gmail.com
File Name: pysos/dag.py
Class Name: SoS_DAG
Method Name: build


Project Name: deepmipt/DeepPavlov
Commit Name: 6d3e4bdc22cc89fb7ecf188ccf0479632012026f
Time: 2018-04-18
Author: dilyara.rimovna@gmail.com
File Name: deeppavlov/models/evolution/check_binary_mask.py
Class Name:
Method Name: get_graph_and_plot


Project Name: vatlab/SoS
Commit Name: ff5bbede0431e5296811dc57432a33a9a68942d0
Time: 2016-09-22
Author: ben.bog@gmail.com
File Name: pysos/dag.py
Class Name: SoS_DAG
Method Name: build


Project Name: deepmipt/DeepPavlov
Commit Name: 4fca544205a55010e8959bb760aece5be80dc3a5
Time: 2018-06-26
Author: dilyara.rimovna@gmail.com
File Name: deeppavlov/models/evolution/check_binary_mask.py
Class Name:
Method Name: get_graph_and_plot