# Cronjob for running qrank-builder in production.
# SPDX-License-Identifier: MIT

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: qrank-builder
  namespace: tool-qrank
  labels:
    name: qrank.builder
    toolforge: tool
spec:
  concurrencyPolicy: Forbid  # don't start new jobs while old is still running
  schedule: "39 14 * * *"  # daily at 14:39
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            toolforge: tool
        spec:
          restartPolicy: OnFailure
          containers:
          - name: qrank-builder
            workingDir: /data/project/qrank
            image: docker-registry.tools.wmflabs.org/toolforge-buster-standalone:latest
            command: [ "bin/qrank-builder", "-dumps=/public/dumps/public", "-storage-key=keys/storage-key" ]
            resources:
              # https://phabricator.wikimedia.org/T277457
              requests:
                memory: "1.5Gi"
                cpu: "2"
              limits:
                memory: "1.5Gi"
                cpu: "2"
