def send_to_orchestration(): dg = nx.MultiDiGraph() staged = {r.name: r.args_show() for r in resource.load_all().values()} commited = data.CD() events = {} changed_nodes = [] for res_uid in staged.keys(): commited_data = commited.get(res_uid, {}) staged_data = staged.get(res_uid, {}) df = create_diff(staged_data, commited_data) if df: events[res_uid] = evapi.all_events(res_uid) changed_nodes.append(res_uid) action = guess_action(commited_data, staged_data) state_change = evapi.StateChange(res_uid, action) state_change.insert(changed_nodes, dg) evapi.build_edges(changed_nodes, dg, events) # what it should be? dg.graph['name'] = 'system_log' return graph.create_plan_from_graph(dg)
def send_to_orchestration(): dg = nx.MultiDiGraph() events = {} changed_nodes = [] for logitem in data.SL(): events[logitem.res] = evapi.all_events(logitem.res) changed_nodes.append(logitem.res) state_change = evapi.StateChange(logitem.res, logitem.action) state_change.insert(changed_nodes, dg) evapi.build_edges(dg, events) # what `name` should be? dg.graph['name'] = 'system_log' return graph.create_plan_from_graph(dg)
def send_to_orchestration(tags=None): dg = nx.MultiDiGraph() events = {} changed_nodes = [] if tags: staged_log = LogItem.log_items_by_tags(tags) else: staged_log = data.SL() for logitem in staged_log: events[logitem.resource] = evapi.all_events(logitem.resource) changed_nodes.append(logitem.resource) state_change = StateChange(logitem.resource, logitem.action) state_change.insert(changed_nodes, dg) evapi.build_edges(dg, events) # what `name` should be? dg.graph['name'] = 'system_log' return graph.create_plan_from_graph(dg)