nodes: 0, module; 1, function_definition; 2, function_name:put; 3, parameters; 4, block; 5, identifier:self; 6, identifier:block_id; 7, identifier:priority; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, with_statement; 12, identifier:pb_type; 13, string; 14, comment:"""Add a Processing Block to the queue.
  
          When a new entry it added, the queue is (re-)sorted by priority
          followed by insertion order (older blocks with equal priority are
          first).
  
          Args:
              block_id (str): Processing Block Identifier
              priority (int): Processing Block scheduling priority
                  (higher values = higher priority)
              pb_type (str): Processing Block type (offline, realtime)
  
          """; 15, comparison_operator:pb_type not in ('offline', 'realtime'); 16, block; 17, with_clause; 18, block; 19, string_content:offline; 20, identifier:pb_type; 21, tuple; 22, raise_statement; 23, with_item; 24, expression_statement; 25, expression_statement; 26, expression_statement; 27, if_statement; 28, expression_statement; 29, expression_statement; 30, expression_statement; 31, expression_statement; 32, comment:# Sort by priority followed by insertion order.; 33, expression_statement; 34, string; 35, string; 36, call; 37, attribute; 38, assignment; 39, assignment; 40, augmented_assignment; 41, comparison_operator:self._block_map.get(block_id) is not None; 42, block; 43, assignment; 44, call; 45, call; 46, call; 47, call; 48, string_content:offline; 49, string_content:realtime; 50, identifier:ValueError; 51, argument_list; 52, identifier:self; 53, identifier:_mutex; 54, identifier:added_time; 55, call; 56, identifier:entry; 57, tuple; 58, attribute; 59, integer:1; 60, call; 61, None; 62, raise_statement; 63, subscript; 64, identifier:entry; 65, attribute; 66, argument_list; 67, attribute; 68, argument_list; 69, attribute; 70, argument_list; 71, attribute; 72, argument_list; 73, string; 74, attribute; 75, argument_list; 76, identifier:priority; 77, binary_operator:sys.maxsize-self._index; 78, identifier:block_id; 79, identifier:pb_type; 80, identifier:added_time; 81, identifier:self; 82, identifier:_index; 83, attribute; 84, argument_list; 85, call; 86, attribute; 87, identifier:block_id; 88, identifier:LOG; 89, identifier:debug; 90, string:"Adding PB %s to queue"; 91, identifier:block_id; 92, attribute; 93, identifier:append; 94, identifier:entry; 95, attribute; 96, identifier:sort; 97, attribute; 98, identifier:reverse; 99, string_content:Invalid PB type.; 100, call; 101, identifier:isoformat; 102, attribute; 103, attribute; 104, attribute; 105, identifier:get; 106, identifier:block_id; 107, identifier:KeyError; 108, argument_list; 109, identifier:self; 110, identifier:_block_map; 111, identifier:self; 112, identifier:_queue; 113, identifier:self; 114, identifier:_queue; 115, identifier:self; 116, identifier:_queue; 117, attribute; 118, argument_list; 119, identifier:sys; 120, identifier:maxsize; 121, identifier:self; 122, identifier:_index; 123, identifier:self; 124, identifier:_block_map; 125, call; 126, attribute; 127, identifier:utcnow; 128, attribute; 129, argument_list; 130, identifier:datetime; 131, identifier:datetime; 132, concatenated_string; 133, identifier:format; 134, identifier:block_id; 135, string:'ERROR: Block id "{}" already exists in '; 136, string; 137, string_content:PC PB queue!
code: def put(self, block_id, priority, pb_type='offline'):
          """Add a Processing Block to the queue.
  
          When a new entry it added, the queue is (re-)sorted by priority
          followed by insertion order (older blocks with equal priority are
          first).
  
          Args:
              block_id (str): Processing Block Identifier
              priority (int): Processing Block scheduling priority
                  (higher values = higher priority)
              pb_type (str): Processing Block type (offline, realtime)
  
          """
          if pb_type not in ('offline', 'realtime'):
              raise ValueError('Invalid PB type.')
  
          with self._mutex:
              added_time = datetime.datetime.utcnow().isoformat()
              entry = (priority, sys.maxsize-self._index, block_id, pb_type,
                       added_time)
              self._index += 1
              if self._block_map.get(block_id) is not None:
                  raise KeyError('ERROR: Block id "{}" already exists in '
                                 'PC PB queue!'.
                                 format(block_id))
              self._block_map[block_id] = entry
              LOG.debug("Adding PB %s to queue", block_id)
              self._queue.append(entry)
              self._queue.sort()  # Sort by priority followed by insertion order.
              self._queue.reverse()