def create_event_dict(start_time, nodes_list):
 import copy
 events = {}
 for node in nodes_list:
  estimated_threads = node.get(u'num_threads', 1)
  estimated_memory_gb = node.get(u'estimated_memory_gb', 1.0)
  runtime_threads = node.get(u'runtime_threads', 0)
  runtime_memory_gb = node.get(u'runtime_memory_gb', 0.0)
  node[u'estimated_threads'] = estimated_threads
  node[u'estimated_memory_gb'] = estimated_memory_gb
  node[u'runtime_threads'] = runtime_threads
  node[u'runtime_memory_gb'] = runtime_memory_gb
  start_node = node
  finish_node = copy.deepcopy(node)
  start_node[u'event'] = u'start'
  finish_node[u'event'] = u'finish'
  start_delta = (node[u'start'] - start_time).total_seconds()
  finish_delta = (node[u'finish'] - start_time).total_seconds()
  if (events.has_key(start_delta) or events.has_key(finish_delta)):
   err_msg = u'Event logged twice or events started at exact same time!'
   raise KeyError(err_msg)
  events[start_delta] = start_node
  events[finish_delta] = finish_node
 return events

def create_event_dict ( start_time , nodes_list ) : import copy events = { } for node in nodes_list : estimated_threads = node . get ( u'num_threads' , 1 ) estimated_memory_gb = node . get ( u'estimated_memory_gb' , 1.0 ) runtime_threads = node . get ( u'runtime_threads' , 0 ) runtime_memory_gb = node . get ( u'runtime_memory_gb' , 0.0 ) node [ u'estimated_threads' ] = estimated_threads node [ u'estimated_memory_gb' ] = estimated_memory_gb node [ u'runtime_threads' ] = runtime_threads node [ u'runtime_memory_gb' ] = runtime_memory_gb start_node = node finish_node = copy . deepcopy ( node ) start_node [ u'event' ] = u'start' finish_node [ u'event' ] = u'finish' start_delta = ( node [ u'start' ] - start_time ) . total_seconds ( ) finish_delta = ( node [ u'finish' ] - start_time ) . total_seconds ( ) if ( events . has_key ( start_delta ) or events . has_key ( finish_delta ) ) : err_msg = u'Event logged twice or events started at exact same time!' raise KeyError ( err_msg ) events [ start_delta ] = start_node events [ finish_delta ] = finish_node return events
function to generate a dictionary of event nodes from the nodes list parameters start_time : datetime .