How to use _connect_tasks method in avocado

Best Python code snippet using avocado_python

runtime.py

Source:runtime.py Github

copy

Full Screen

...222 runnable, status_server_uri, job_id223 )224 if pre_tasks:225 pre_tasks.append(runtime_test)226 self._connect_tasks(pre_tasks)227 def _connect_tasks(self, tasks):228 for dependency, task in zip(tasks, tasks[1:]):229 self.graph[task] = task230 self.graph[dependency] = dependency231 task.dependencies.append(dependency)232 def get_tasks_in_topological_order(self):233 """Computes the topological order of runtime tasks in graph234 :returns: runtime tasks in topological order235 :rtype: list236 """237 def topological_order_util(vertex, visited, topological_order):238 visited[vertex] = True239 for v in vertex.dependencies:240 if not visited[v]:241 topological_order_util(v, visited, topological_order)...

Full Screen

Full Screen

dnn_to_task_graph.py

Source:dnn_to_task_graph.py Github

copy

Full Screen

...100 task_layer_ids = task_name_to_layer_ids(task_name)101 if layer_id in task_layer_ids:102 return t_id103 t_id += 1104 def _connect_tasks():105 """ Connect tasks, i.e., fill in tasks adjacent and reverse adjacent lists"""106 for connection in dnn.get_connections():107 src_task_id = find_task_id(connection.src.id)108 dst_task_id = find_task_id(connection.dst.id)109 if src_task_id is not None and dst_task_id is not None:110 if src_task_id != dst_task_id:111 tasks_adjacent_list[src_task_id].append(dst_task_id)112 tasks_reverse_adjacent_list[dst_task_id].append(src_task_id)113 else:114 raise Exception("Tasks connection error")115 def _compute_communication_costs():116 layers = dnn.get_layers()117 for task_name in tasks:118 task_output_layer_id = last_layer_id(task_name)119 task_output_layer = layers[task_output_layer_id]120 layer_out_tokens = task_output_layer.ofm * task_output_layer.oh * task_output_layer.ow121 tasks_out_comm_cost.append(layer_out_tokens)122 # main script123 set_built_in(dnn, built_in_ops)124 for layer in dnn.get_layers():125 layer.visited = False126 # create tasks127 tasks = []128 input_layer = dnn.get_input_layer()129 _create_tasks(input_layer)130 # for multi-input_examples DNN131 for layer in dnn.get_layers():132 if not layer.visited:133 _create_tasks(layer)134 tasks.sort(key=lambda task_name: first_layer_id(task_name))135 # create connections (create tasks adjacent and reverse-adjacent lists)136 tasks_adjacent_list = [[] for _ in tasks]137 tasks_reverse_adjacent_list = [[] for _ in tasks]138 _connect_tasks()139 # compute communication costs140 tasks_out_comm_cost = []141 _compute_communication_costs()142 app_graph = TaskGraph(tasks, tasks_adjacent_list, tasks_reverse_adjacent_list, tasks_out_comm_cost)143 app_graph.name = dnn.name144 # add layer names as jobs145 app_graph.jobs_per_task = [[] for _ in range(len(tasks))]146 dnn_layers = dnn.get_layers()147 for layer_id in range(len(dnn_layers)):148 layer = dnn_layers[layer_id]149 task_id = get_task_id(app_graph, layer_id)150 app_graph.jobs_per_task[task_id].append(layer.name)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful