Skip to content
Snippets Groups Projects
Commit a216e1cc authored by George Marchment's avatar George Marchment
Browse files

Added topological order calculation between the clusters

parent cb0f0ccb
No related branches found
No related tags found
No related merge requests found
Pipeline #14432 failed with stage
in 2 minutes and 56 seconds
......@@ -23,6 +23,7 @@ class Graph():
self.link_dico = None
#Dico to graph without operations
self.dico_process_dependency_graph = {}
self.user_view = {}
self.user_view_with_subworkflows = {}
self.new_nodes_user_view = []
self.dico_wo_branch_operation = {}
......@@ -313,17 +314,17 @@ class Graph():
self.initialise_flattened_dico(self.full_dico)
dico = remove_artificial_nodes(self.dico_flattened)
user_view, self.new_nodes_user_view = relev_user_view_builder(dico, relevant_modules=relevant_processes)
self.user_view, self.new_nodes_user_view = relev_user_view_builder(dico, relevant_modules=relevant_processes)
with open(self.get_output_dir()/ "graphs/user_view.json", 'w') as output_file :
json.dump(user_view, output_file, indent=4)
json.dump(self.user_view, output_file, indent=4)
user_view_with_subworkflows = add_subworkflows_2_dico(self.dico_process_dependency_graph, user_view)
user_view_with_subworkflows = add_subworkflows_2_dico(self.dico_process_dependency_graph, self.user_view)
with open(self.get_output_dir()/ "graphs/user_view_with_subworkflows.json", 'w') as output_file :
json.dump(user_view_with_subworkflows, output_file, indent=4)
return user_view, user_view_with_subworkflows
return self.user_view, user_view_with_subworkflows
def generate_user_view(self, relevant_processes = [], render_graphs = True):
user_view, user_view_with_subworkflows = self.get_user_view_graph(relevant_processes = relevant_processes)
......@@ -332,15 +333,16 @@ class Graph():
generate_graph(self.get_output_dir()/'graphs'/"user_view_with_subworkflows", user_view_with_subworkflows, label_edge=True, label_node=True, render_graphs = render_graphs, root = False, relevant_nodes = copy.deepcopy(relevant_processes))
#This method returns the list of the clusters in topological order
def get_clusters_from_user_view(self):
topological_order = topological_sort(initia_link_dico_rec(self.user_view))
tab = []
for cluster in self.new_nodes_user_view:
for cluster in topological_order:
temp = []
for ele in cluster:
for ele in cluster.split("_$$_"):
temp.append(get_object(ele))
tab.append(temp)
return tab
#============================
......
......@@ -804,6 +804,8 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
# else:
# print(c, c.get_code()[:20], c.artificial)
for c in clusters:
print(len(c))
for cluster in clusters:
tab = []
for e in executors_in_order:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment