diff --git a/dispatcher/backend/maint-scripts/find_schedules_in_errors.py b/dispatcher/backend/maint-scripts/find_schedules_in_errors.py index c7c39b39..e8f202c0 100755 --- a/dispatcher/backend/maint-scripts/find_schedules_in_errors.py +++ b/dispatcher/backend/maint-scripts/find_schedules_in_errors.py @@ -2,7 +2,7 @@ """ Find all schedules which are enabled and have at least the last two tasks which failed in a row - + ./find_schedules_in_errors""" import sqlalchemy as sa @@ -14,7 +14,7 @@ @dbsession def find_schedules_in_errors(session: so.Session): - print(f"looking after schedules with bad status") + print("Looking after schedules with bad status") stmt = ( sa.select(dbm.Schedule).where(dbm.Schedule.enabled).order_by(dbm.Schedule.name) @@ -32,7 +32,8 @@ def find_schedules_in_errors(session: so.Session): if nb_success == 0: print( - f"Never succeeded: schedule {schedule.name} (periodicity={schedule.periodicity}) never succeeded out of {total} attempts" + f"Never succeeded: schedule {schedule.name} (periodicity=" + f"{schedule.periodicity}) never succeeded out of {total} attempts" ) continue @@ -45,7 +46,10 @@ def find_schedules_in_errors(session: so.Session): if nb_failures_in_a_row > 1: print( - f"Many failures in a row: schedule {schedule.name} (periodicity={schedule.periodicity}) failed {nb_failures_in_a_row} times in a row, nb_success: {nb_success}, nb_failed: {nb_failed}, total: {total}" + f"Many failures in a row: schedule {schedule.name} (periodicity=" + f"{schedule.periodicity}) failed {nb_failures_in_a_row} times in" + f" a row, nb_success: {nb_success}, nb_failed: {nb_failed}," + f" total: {total}" ) continue diff --git a/dispatcher/backend/maint-scripts/relaunch_failed_recipes.py b/dispatcher/backend/maint-scripts/relaunch_failed_recipes.py index 6e5e13dc..fa4340f1 100755 --- a/dispatcher/backend/maint-scripts/relaunch_failed_recipes.py +++ b/dispatcher/backend/maint-scripts/relaunch_failed_recipes.py @@ -23,7 +23,7 @@ @dbsession def relaunch_failed_recipes(session: so.Session, start_date: str): - print(f"Loading tasks that have failed since start_date") + print("Loading tasks that have failed since start_date") start_datetime = datetime.datetime.fromisoformat(start_date) stmt = ( @@ -46,7 +46,8 @@ def relaunch_failed_recipes(session: so.Session, start_date: str): ).total_seconds() if scraper_duration > 60: print( - f"Ignoring schedule {task.schedule.name}, duration was {scraper_duration}" + f"Ignoring schedule {task.schedule.name}, duration was " + f"{scraper_duration}" ) continue @@ -60,7 +61,8 @@ def relaunch_failed_recipes(session: so.Session, start_date: str): if nb_success == 0: print( - f"Ignoring schedule {task.schedule.name}, never succeeded out of {total} attempts" + f"Ignoring schedule {task.schedule.name}, never succeeded out of " + f"{total} attempts" ) continue @@ -73,12 +75,16 @@ def relaunch_failed_recipes(session: so.Session, start_date: str): if nb_failures_in_a_row > 1: print( - f"Ignoring schedule {task.schedule.name}, too many failures in a row, failed: {nb_failed}, failure_in_a_row: {nb_failures_in_a_row}, nb_success: {nb_success}, total: {total}" + f"Ignoring schedule {task.schedule.name}, too many failures in a row," + f" failed: {nb_failed}, failure_in_a_row: {nb_failures_in_a_row}," + f" nb_success: {nb_success}, total: {total}" ) continue print( - f"Requesting schedule {task.schedule.name} failed: {nb_failed}, failure_in_a_row: {nb_failures_in_a_row}, nb_success: {nb_success}, total: {total}" + f"Requesting schedule {task.schedule.name} failed: {nb_failed}, " + f"failure_in_a_row: {nb_failures_in_a_row}, nb_success: {nb_success}," + f" total: {total}" ) # Uncomment below to really request the schedule