# HG changeset patch # User RhodeCode Admin # Date 2023-08-17 12:29:16 # Node ID 14e256361f253cc46a601562df00a8c4a7e3fe7c # Parent f3cd5ebe1a1dba5cd1a246c7c74a3a75e4223071 small changes for scheduler fixes of EE edition diff --git a/rhodecode/lib/celerylib/utils.py b/rhodecode/lib/celerylib/utils.py --- a/rhodecode/lib/celerylib/utils.py +++ b/rhodecode/lib/celerylib/utils.py @@ -54,9 +54,7 @@ def safe_json(get, section, key): value = get(key) json_value = json.loads(value) except ValueError: - msg = 'The %s=%s is not valid json in section %s' % ( - key, value, section - ) + msg = f'The {key}={value} is not valid json in section {section}' raise ValueError(msg) return json_value @@ -71,11 +69,7 @@ def raw_2_schedule(schedule_value, sched scheduler_cls = schedule_type_map.get(schedule_type) if scheduler_cls is None: - raise ValueError( - 'schedule type %s in section is invalid' % ( - schedule_type, - ) - ) + raise ValueError(f'schedule type {schedule_type} in section is invalid') try: schedule = scheduler_cls(schedule_value) except TypeError: diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -5290,8 +5290,11 @@ class ScheduleEntry(Base, BaseModel): UniqueConstraint('task_uid', name='s_task_uid_idx'), base_table_args, ) - - schedule_types = ['crontab', 'timedelta', 'integer'] + SCHEDULE_TYPE_INTEGER = "integer" + SCHEDULE_TYPE_CRONTAB = "crontab" + SCHEDULE_TYPE_TIMEDELTA = "timedelta" + + schedule_types = [SCHEDULE_TYPE_CRONTAB, SCHEDULE_TYPE_TIMEDELTA, SCHEDULE_TYPE_INTEGER] schedule_entry_id = Column('schedule_entry_id', Integer(), primary_key=True) schedule_name = Column("schedule_name", String(255), nullable=False, unique=None, default=None)