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

Method _save_new_source

app/objects/c_operation.py:445–457  ·  view source on GitHub ↗
(self, services)

Source from the content-addressed store, hash-verified

443 stopping_conditions=self.planner.stopping_conditions)
444
445 async def _save_new_source(self, services):
446 def fact_to_dict(f):
447 if f:
448 return dict(trait=f.trait, value=f.value, score=f.score)
449 data = dict(
450 id=str(uuid.uuid4()),
451 name=self.name,
452 facts=[fact_to_dict(f) for link in self.chain for f in link.facts],
453 relationships=[dict(source=fact_to_dict(r.source), edge=r.edge,
454 target=fact_to_dict(r.target), score=r.score)
455 for link in self.chain for r in link.relationships]
456 )
457 await services.get('rest_svc').persist_source(dict(access=[self.access]), data)
458
459 async def update_operation_agents(self, services):
460 self.agents = await services.get('rest_svc').construct_agents_for_group(self.group)

Callers 1

closeMethod · 0.95

Calls 1

persist_sourceMethod · 0.45

Tested by

no test coverage detected