-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding clean stats cache cron job (#1986)
* adding clean stats cache cron job * Apply suggestions from code review Co-authored-by: Quentin Lhoest <[email protected]> --------- Co-authored-by: Quentin Lhoest <[email protected]>
- Loading branch information
1 parent
47171d7
commit 520157c
Showing
6 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
chart/templates/cron-jobs/clean-stats-cache/_container.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2023 The HuggingFace Authors. | ||
|
||
{{- define "containerCleanStatsCache" -}} | ||
- name: "{{ include "name" . }}-clean-stats-cache" | ||
image: {{ include "jobs.cacheMaintenance.image" . }} | ||
imagePullPolicy: {{ .Values.images.pullPolicy }} | ||
volumeMounts: | ||
{{ include "volumeMountDescriptiveStatisticsRW" . | nindent 2 }} | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
resources: {{ toYaml .Values.cleanStatsCache.resources | nindent 4 }} | ||
env: | ||
{{ include "envCommon" . | nindent 2 }} | ||
- name: CACHE_MAINTENANCE_ACTION | ||
value: {{ .Values.cleanStatsCache.action | quote }} | ||
- name: LOG_LEVEL | ||
value: {{ .Values.cleanStatsCache.log.level | quote }} | ||
- name: DIRECTORY_CLEANING_CACHE_DIRECTORY | ||
value: {{ .Values.descriptiveStatistics.cacheDirectory | quote }} | ||
- name: DIRECTORY_CLEANING_SUBFOLDER_PATTERN | ||
value: {{ .Values.cleanStatsCache.subfolderPattern | quote }} | ||
- name: DIRECTORY_CLEANING_EXPIRED_TIME_INTERVAL_SECONDS | ||
value: {{ .Values.cleanStatsCache.expiredTimeIntervalSeconds | quote }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright 2023 The HuggingFace Authors. | ||
|
||
{{- if and .Values.images.jobs.cacheMaintenance .Values.cleanStatsCache.enabled }} | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
labels: {{ include "labels.cleanStatsCache" . | nindent 4 }} | ||
name: "{{ include "name" . }}-job-clean-stats-cache" | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
schedule: {{ .Values.cleanStatsCache.schedule | quote }} | ||
jobTemplate: | ||
spec: | ||
ttlSecondsAfterFinished: 3600 | ||
template: | ||
spec: | ||
restartPolicy: OnFailure | ||
{{- include "dnsConfig" . | nindent 10 }} | ||
{{- include "image.imagePullSecrets" . | nindent 6 }} | ||
nodeSelector: {{ toYaml .Values.cleanStatsCache.nodeSelector | nindent 12 }} | ||
tolerations: {{ toYaml .Values.cleanStatsCache.tolerations | nindent 12 }} | ||
containers: {{ include "containerCleanStatsCache" . | nindent 12 }} | ||
securityContext: {{ include "securityContext" . | nindent 12 }} | ||
initContainers: {{ include "initContainerDescriptiveStatistics" . | nindent 12 }} | ||
volumes: {{ include "volumeDescriptiveStatistics" . | nindent 12 }} | ||
{{- end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters