docs adn more plan

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-01 03:34:13 +00:00
parent af408d0747
commit 6caeed14cb
3 changed files with 592 additions and 19 deletions

View File

@@ -98,6 +98,18 @@ class AutomationService:
raise ValueError("Automation already running for this site (cache lock)")
try:
# Capture initial queue snapshot for accurate progress tracking
# Do this BEFORE credit check to validate there's work to do
initial_snapshot = self._capture_initial_snapshot()
# Check if there are any items to process across all stages
total_pending = initial_snapshot.get('total_initial_items', 0)
if total_pending == 0:
raise ValueError(
"No items available to process. Add keywords, clusters, ideas, tasks, "
"or content to the pipeline before running automation."
)
# Estimate credits needed
estimated_credits = self.estimate_credits()
@@ -109,9 +121,6 @@ class AutomationService:
# Create run_id and log files
run_id = self.logger.start_run(self.account.id, self.site.id, trigger_type)
# Capture initial queue snapshot for accurate progress tracking
initial_snapshot = self._capture_initial_snapshot()
# Create AutomationRun record
self.run = AutomationRun.objects.create(
run_id=run_id,
@@ -1609,14 +1618,6 @@ class AutomationService:
cache.delete(f'automation_lock_{self.site.id}')
logger.info(f"[AutomationService] Stage 7 complete: {approved_count} content pieces approved and published")
self.run.status = 'completed'
self.run.completed_at = datetime.now()
self.run.save()
# Release lock
cache.delete(f'automation_lock_{self.site.id}')
logger.info(f"[AutomationService] Stage 7 complete: Automation ended, {total_count} content ready for review")
def pause_automation(self):
"""Pause current automation run"""