Skip to content

Commit

Permalink
Update intervals and cron cleaning logic
Browse files Browse the repository at this point in the history
  • Loading branch information
polyaxon-ci committed Jul 31, 2024
1 parent c14d3da commit dd59a79
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion haupt/haupt/common/options/registry/cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CleaningIntervalsOption(Option):

class CleaningIntervalsActivityLogs(CleaningIntervalsOption):
key = CLEANING_INTERVALS_ACTIVITY_LOGS
default = 15
default = 90
description = "A cleaning interval for activity logs in days"


Expand Down
18 changes: 9 additions & 9 deletions haupt/haupt/common/settings/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def set_celery(
context[
"CELERY_WORKER_MAX_MEMORY_PER_CHILD"
] = config.celery_worker_max_memory_per_child

class Intervals:
"""All intervals are in seconds"""

OPERATIONS_DEFAULT_RETRY_DELAY = config.intervals_operations_default_retry_delay
OPERATIONS_MAX_RETRY_DELAY = config.intervals_operations_max_retry_delay
RUNS_SCHEDULER = config.intervals_runs_scheduler

context["Intervals"] = Intervals
context["CELERY_TASK_ROUTES"] = routes
if schedules:
context["CELERY_BEAT_SCHEDULE"] = schedules

context[
"CLEANING_INTERVALS_ACTIVITY_LOGS"
] = config.cleaning_intervals_activity_logs
context[
"CLEANING_INTERVALS_NOTIFICATIONS"
] = config.cleaning_intervals_notifications
context["CLEANING_INTERVALS_ARCHIVES"] = config.cleaning_intervals_archives
context["CLEANING_INTERVALS_DELETION"] = config.cleaning_intervals_deletion
39 changes: 21 additions & 18 deletions haupt/haupt/schemas/platform_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,32 +115,35 @@ class PlatformConfig(BaseSchemaModel):
celery_worker_max_memory_per_child: Optional[int] = Field(
alias="POLYAXON_CELERY_WORKER_MAX_MEMORY_PER_CHILD", default=400000
)
intervals_operations_default_retry_delay: Optional[int] = Field(
alias="POLYAXON_INTERVALS_OPERATIONS_DEFAULT_RETRY_DELAY", default=60
cron_intervals_heartbeat_check: Optional[int] = Field(
alias="POLYAXON_CRON_INTERVALS_HEARTBEAT_CHECK", default=60
)
intervals_operations_max_retry_delay: Optional[int] = Field(
alias="POLYAXON_INTERVALS_OPERATIONS_MAX_RETRY_DELAY", default=3600
cron_intervals_stats_calculation: Optional[int] = Field(
alias="POLYAXON_CRON_INTERVALS_STATS_CALCULATION", default=60 * 5
)
intervals_runs_scheduler: Optional[int] = Field(
alias="POLYAXON_INTERVALS_RUNS_SCHEDULER", default=30
cron_intervals_clean_activity_logs: Optional[int] = Field(
alias="POLYAXON_CRON_INTERVALS_CLEAN_ACTIVITY_LOGS", default=60
)
intervals_heartbeat_check: Optional[int] = Field(
alias="POLYAXON_INTERVALS_HEARTBEAT_CHECK", default=60
cron_intervals_clean_support_access: Optional[int] = Field(
alias="POLYAXON_CRON_INTERVALS_CLEAN_SUPPORT_ACCESS", default=60
)
intervals_stats_calculation: Optional[int] = Field(
alias="POLYAXON_INTERVALS_STATS_CALCULATION", default=60 * 5
cron_intervals_clean_notifications: Optional[int] = Field(
alias="POLYAXON_CRON_INTERVALS_CLEAN_NOTIFICATIONS", default=60
)
intervals_clean_activity_logs: Optional[int] = Field(
alias="POLYAXON_INTERVALS_CLEAN_ACTIVITY_LOGS", default=60
cron_intervals_delete_archived: Optional[int] = Field(
alias="POLYAXON_CRON_INTERVALS_DELETE_ARCHIVED", default=60
)
intervals_clean_support_access: Optional[int] = Field(
alias="POLYAXON_INTERVALS_CLEAN_SUPPORT_ACCESS", default=60
cleaning_intervals_activity_logs: Optional[int] = Field(
alias="POLYAXON_CLEANING_INTERVALS_ACTIVITY_LOGS", default=3 * 30
)
intervals_clean_notifications: Optional[int] = Field(
alias="POLYAXON_INTERVALS_CLEAN_NOTIFICATIONS", default=60
cleaning_intervals_notifications: Optional[int] = Field(
alias="POLYAXON_CLEANING_INTERVALS_NOTIFICATIONS", default=30
)
intervals_delete_archived: Optional[int] = Field(
alias="POLYAXON_INTERVALS_DELETE_ARCHIVED", default=60
cleaning_intervals_archives: Optional[int] = Field(
alias="POLYAXON_CLEANING_INTERVALS_ARCHIVES", default=30
)
cleaning_intervals_deletion: Optional[int] = Field(
alias="POLYAXON_CLEANING_INTERVALS_DELETION", default=15
)

internal_exchange: Optional[str] = Field(
Expand Down

0 comments on commit dd59a79

Please sign in to comment.