|
@@ -3,6 +3,7 @@
|
|
|
from __future__ import annotations
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
import json
|
|
import json
|
|
|
|
|
+import logging
|
|
|
import os
|
|
import os
|
|
|
import time
|
|
import time
|
|
|
import uuid
|
|
import uuid
|
|
@@ -14,6 +15,9 @@ import requests
|
|
|
from storage import connect
|
|
from storage import connect
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+logger = logging.getLogger(__name__)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
ACTIVE_STATUS = "AD_STATUS_NORMAL"
|
|
ACTIVE_STATUS = "AD_STATUS_NORMAL"
|
|
|
SUSPEND_STATUS = "AD_STATUS_SUSPEND"
|
|
SUSPEND_STATUS = "AD_STATUS_SUSPEND"
|
|
|
DELETED_STATUS = "AD_STATUS_DELETED"
|
|
DELETED_STATUS = "AD_STATUS_DELETED"
|
|
@@ -499,8 +503,22 @@ class TencentClient:
|
|
|
try:
|
|
try:
|
|
|
creative = self.get_dynamic_creative(account_id, dynamic_creative_id)
|
|
creative = self.get_dynamic_creative(account_id, dynamic_creative_id)
|
|
|
last_actual = {
|
|
last_actual = {
|
|
|
- "configured_status": creative.get("configured_status")
|
|
|
|
|
|
|
+ "configured_status": creative.get("configured_status"),
|
|
|
|
|
+ "system_status": creative.get("system_status"),
|
|
|
|
|
+ "creative_set_approval_status": creative.get(
|
|
|
|
|
+ "creative_set_approval_status"
|
|
|
|
|
+ ),
|
|
|
|
|
+ "dynamic_creative_name": creative.get("dynamic_creative_name"),
|
|
|
}
|
|
}
|
|
|
|
|
+ logger.info(
|
|
|
|
|
+ "creative delete readback not converged account=%s creative=%s "
|
|
|
|
|
+ "attempt=%d/%d readback=%s",
|
|
|
|
|
+ account_id,
|
|
|
|
|
+ dynamic_creative_id,
|
|
|
|
|
+ attempt,
|
|
|
|
|
+ self.verify_attempts,
|
|
|
|
|
+ last_actual,
|
|
|
|
|
+ )
|
|
|
except Exception as exc:
|
|
except Exception as exc:
|
|
|
if str(exc).startswith("Dynamic creative not found:"):
|
|
if str(exc).startswith("Dynamic creative not found:"):
|
|
|
return {
|
|
return {
|
|
@@ -510,8 +528,28 @@ class TencentClient:
|
|
|
"deleted_from_listing": True,
|
|
"deleted_from_listing": True,
|
|
|
}
|
|
}
|
|
|
last_actual = {"verification_error": str(exc)}
|
|
last_actual = {"verification_error": str(exc)}
|
|
|
|
|
+ logger.info(
|
|
|
|
|
+ "creative delete readback error account=%s creative=%s "
|
|
|
|
|
+ "attempt=%d/%d error=%s",
|
|
|
|
|
+ account_id,
|
|
|
|
|
+ dynamic_creative_id,
|
|
|
|
|
+ attempt,
|
|
|
|
|
+ self.verify_attempts,
|
|
|
|
|
+ exc,
|
|
|
|
|
+ )
|
|
|
if attempt < self.verify_attempts:
|
|
if attempt < self.verify_attempts:
|
|
|
time.sleep(self.verify_delay_seconds)
|
|
time.sleep(self.verify_delay_seconds)
|
|
|
|
|
+ logger.error(
|
|
|
|
|
+ "creative delete verification FAILED account=%s creative=%s "
|
|
|
|
|
+ "delete_response=%s verify_attempts=%s verify_delay_seconds=%s "
|
|
|
|
|
+ "readback=%s",
|
|
|
|
|
+ account_id,
|
|
|
|
|
+ dynamic_creative_id,
|
|
|
|
|
+ data,
|
|
|
|
|
+ self.verify_attempts,
|
|
|
|
|
+ self.verify_delay_seconds,
|
|
|
|
|
+ last_actual,
|
|
|
|
|
+ )
|
|
|
raise PostWriteVerificationError(
|
|
raise PostWriteVerificationError(
|
|
|
account_id=account_id,
|
|
account_id=account_id,
|
|
|
adgroup_id=dynamic_creative_id,
|
|
adgroup_id=dynamic_creative_id,
|