duplicate_checker.py aktualisiert

This commit is contained in:
2025-08-18 11:32:37 +00:00
parent ce9b458cef
commit af2e60f93d

View File

@@ -15,16 +15,24 @@ from google_sheet_handler import GoogleSheetHandler
STATUS_DIR = "job_status"
def update_status(job_id, status, progress_message):
"""Schreibt den aktuellen Status in eine JSON-Datei."""
if not job_id: return
status_file = os.path.join(STATUS_DIR, f"{job_id}.json")
try:
# Lese alte Daten, um Action und Startzeit zu erhalten
try:
with open(status_file, 'r') as f:
data = json.load(f)
except FileNotFoundError:
data = {}
data.update({"status": status, "progress": progress_message})
with open(status_file, 'w') as f:
json.dump({"status": status, "progress": progress_message}, f)
json.dump(data, f)
except Exception as e:
# Logge den Fehler, aber lasse das Hauptskript nicht abstürzen
logging.error(f"Konnte Statusdatei für Job {job_id} nicht schreiben: {e}")
# duplicate_checker.py v2.15
# Quality-first ++: Domain-Gate, Location-Penalties, Smart Blocking (IDF-light),
# Serp-Trust, Weak-Threshold, City-Bias-Guard, Prefilter tightened, Metrics
@@ -436,12 +444,8 @@ def main(job_id=None):
logger.info(f"Serp Vertrauen: {dict(serp_counts)}")
logger.info(f"Config: TH={SCORE_THRESHOLD}, TH_WEAK={SCORE_THRESHOLD_WEAK}, MIN_NAME_FOR_DOMAIN={MIN_NAME_FOR_DOMAIN}, Penalties(city={CITY_MISMATCH_PENALTY},country={COUNTRY_MISMATCH_PENALTY}), Prefilter(partial>={PREFILTER_MIN_PARTIAL}, limit={PREFILTER_LIMIT})")
if __name__=='__main__':
# Hinzufügen des Argument-Parsers für die Job-ID
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--job-id", type=str, help="Eindeutige ID für den Job-Status.")
# Fügen Sie hier weitere Argumente hinzu, die Ihr Skript benötigt
args = parser.parse_args()
# Rufen Sie die main-Funktion mit der Job-ID auf
main(job_id=args.job_id)