Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
fix: resolve merge conflicts and address resource leak concerns
KaifAhmad1f02cda26386b
diff --cc semantica/pipeline/resource_scheduler.pyindex 97076b82,e81407c1..d3ace0c2--- a/semantica/pipeline/resource_scheduler.py+++ b/semantica/pipeline/resource_scheduler.py@@@ -109,7 -109,7 +109,7 @@@ class ResourceSchedulerself.resources: Dict[str, Resource] = {}self.allocations: Dict[str, ResourceAllocation] = {}- self.lock = threading.RLock() # RLock allows re-entrancy for nested lock acquisition in allocate_resources- self.lock = threading.RLock() # RLock: allocate_resources holds lock and calls allocate_cpu/memory/gpu which also acquire it++self.lock = threading.RLock() # RLock allows re-entrancy for nested lock acquisition in allocate_resourcesself._initialize_resources()@@@ -223,22 -232,6 +223,25 @@@if gpu_allocation:allocations["gpu"] = gpu_allocation- # Update progress tracking outside of lock++ # Validate allocations before returning++ if not allocations:++ # Clean up any allocated resources before raising error++ if allocations:++ self.release_resources(allocations)++ raise ValidationError("No resources were allocated - insufficient capacity")++++ # Update progress tracking outside of lock (after validation)+ self.progress_tracker.update_tracking(+ tracking_id, message="Allocating CPU resources..."+ )+ self.progress_tracker.update_tracking(+ tracking_id, message="Allocating memory resources..."+ )+ if options.get("gpu_device") is not None:+ self.progress_tracker.update_tracking(+ tracking_id, message="Allocating GPU resources..."+ )-- # Validate allocations before returning- if not allocations:- raise ValidationError("No resources were allocated - insufficient capacity")+self.progress_tracker.stop_tracking(tracking_id,status="completed",@@@ -247,6 -240,6 +250,10 @@@return allocationsexcept Exception as e:++ # Clean up resources on any error++ if 'allocations' in locals() and allocations:++ self.release_resources(allocations)++self.progress_tracker.stop_tracking(tracking_id, status="failed", message=str(e))