lists of shares. job deletion only deltes outputs
This commit is contained in:
@@ -91,7 +91,7 @@ class L2SharedChecker:
|
||||
|
||||
# Query L2
|
||||
try:
|
||||
url = f"{self.l2_server}/registry/by-hash/{content_hash}"
|
||||
url = f"{self.l2_server}/assets/by-hash/{content_hash}"
|
||||
logger.info(f"L2 check: GET {url}")
|
||||
resp = requests.get(url, timeout=5)
|
||||
logger.info(f"L2 check response: {resp.status_code}")
|
||||
@@ -506,6 +506,61 @@ class L1CacheManager:
|
||||
return True, "Activity discarded"
|
||||
return False, "Failed to discard"
|
||||
|
||||
def discard_activity_outputs_only(self, activity_id: str) -> tuple[bool, str]:
|
||||
"""
|
||||
Discard an activity, deleting only outputs and intermediates.
|
||||
|
||||
Inputs (cache items, configs) are preserved.
|
||||
|
||||
Returns:
|
||||
(success, message) tuple
|
||||
"""
|
||||
activity = self.activity_store.get(activity_id)
|
||||
if not activity:
|
||||
return False, "Activity not found"
|
||||
|
||||
# Check if output is pinned
|
||||
if activity.output_id:
|
||||
entry = self.cache.get_entry(activity.output_id)
|
||||
if entry:
|
||||
pinned, reason = self.is_pinned(entry.content_hash)
|
||||
if pinned:
|
||||
return False, f"Output is pinned ({reason})"
|
||||
|
||||
# Delete output
|
||||
if activity.output_id:
|
||||
entry = self.cache.get_entry(activity.output_id)
|
||||
if entry:
|
||||
# Remove from cache
|
||||
self.cache.remove(activity.output_id)
|
||||
# Remove from content index
|
||||
if entry.content_hash in self._content_index:
|
||||
del self._content_index[entry.content_hash]
|
||||
self._save_content_index()
|
||||
# Delete from legacy dir if exists
|
||||
legacy_path = self.legacy_dir / entry.content_hash
|
||||
if legacy_path.exists():
|
||||
legacy_path.unlink()
|
||||
|
||||
# Delete intermediates
|
||||
for node_id in activity.intermediate_ids:
|
||||
entry = self.cache.get_entry(node_id)
|
||||
if entry:
|
||||
self.cache.remove(node_id)
|
||||
if entry.content_hash in self._content_index:
|
||||
del self._content_index[entry.content_hash]
|
||||
legacy_path = self.legacy_dir / entry.content_hash
|
||||
if legacy_path.exists():
|
||||
legacy_path.unlink()
|
||||
|
||||
if activity.intermediate_ids:
|
||||
self._save_content_index()
|
||||
|
||||
# Remove activity record (inputs remain in cache)
|
||||
self.activity_store.remove(activity_id)
|
||||
|
||||
return True, "Activity discarded (outputs only)"
|
||||
|
||||
def cleanup_intermediates(self) -> int:
|
||||
"""Delete all intermediate cache entries (reconstructible)."""
|
||||
return self.activity_manager.cleanup_intermediates()
|
||||
|
||||
Reference in New Issue
Block a user