MCPcopy
hub / github.com/apache/caldera / parse

Method parse

app/objects/secondclass/c_link.py:196–214  ·  view source on GitHub ↗
(self, operation, result)

Source from the content-addressed store, hash-verified

194 return False
195
196 async def parse(self, operation, result):
197 if self.status != 0:
198 return
199 for parser in self.executor.parsers:
200 source_facts = operation.source.facts if operation else []
201 try:
202 relationships = await self._parse_link_result(result, parser, source_facts)
203
204 if len(relationships) > 0 and relationships[0] == PARSER_SIGNALS_FAILURE:
205 logging.getLogger('link').debug(f'link {self.id} (ability id={self.ability.ability_id}) encountered '
206 f'an error during execution, which was caught during parsing.')
207 self.status = self.states['ERROR']
208 relationships = [] # we didn't actually get anything out of this, so let's reset
209 else:
210 await self.create_relationships(relationships, operation)
211 await update_scores(operation, increment=len(relationships), used=self.used, facts=self.facts)
212 except Exception as e:
213 logging.getLogger('link').debug('error in %s while parsing ability %s: %s'
214 % (parser.module, self.ability.ability_id, e))
215
216 def apply_id(self, host):
217 self.id = str(uuid.uuid4())

Callers 1

_parse_link_resultMethod · 0.45

Calls 3

_parse_link_resultMethod · 0.95
create_relationshipsMethod · 0.95
update_scoresFunction · 0.85

Tested by

no test coverage detected