Page MenuHomePhabricator

toolforge-jobs rejects valid schedule time
Closed, DuplicatePublicBUG REPORT

Description

Try the following command on the toolforge bastions:

$ toolforge-jobs run diacritics_moves --image tf-python39 --email onfailure --schedule '30 0 25 * *' --command whatever_command.sh

I get the following response:

ERROR: unable to create job: "HTTP 422: likely wrong schedule time. k8s JSON: {\"apiVersion\": \"batch/v1beta1\", \"kind\": \"CronJob\", \"metadata\": {\"name\": \"diacritics_moves\", \"namespace\": \"tool-patrocle\", \"labels\": {\"toolforge\": \"tool\", \"app.kubernetes.io/version\": \"1\", \"app.kubernetes.io/managed-by\": \"toolforge-jobs-framework\", \"app.kubernetes.io/created-by\": \"patrocle\", \"app.kubernetes.io/component\": \"cronjobs\", \"app.kubernetes.io/name\": \"diacritics_moves\", \"jobs.toolforge.org/filelog\": \"yes\", \"jobs.toolforge.org/emails\": \"onfailure\"}}, \"spec\": {\"schedule\": \"30 0 25 * *\", \"successfulJobsHistoryLimit\": 0, \"failedJobsHistoryLimit\": 0, \"concurrencyPolicy\": \"Forbid\", \"jobTemplate\": {\"spec\": {\"template\": {\"metadata\": {\"labels\": {\"toolforge\": \"tool\", \"app.kubernetes.io/version\": \"1\", \"app.kubernetes.io/managed-by\": \"toolforge-jobs-framework\", \"app.kubernetes.io/created-by\": \"patrocle\", \"app.kubernetes.io/component\": \"cronjobs\", \"app.kubernetes.io/name\": \"diacritics_moves\", \"jobs.toolforge.org/filelog\": \"yes\", \"jobs.toolforge.org/emails\": \"onfailure\"}}, \"spec\": {\"restartPolicy\": \"Never\", \"containers\": [{\"name\": \"diacritics_moves\", \"image\": \"docker-registry.tools.wmflabs.org/toolforge-python39-sssd-base:latest\", \"workingDir\": \"/data/project/patrocle\", \"command\": [\"/bin/sh\", \"-c\", \"--\", \"python3 -v 1>>diacritics_moves.out 2>>diacritics_moves.err\"], \"resources\": {}, \"env\": [{\"name\": \"HOME\", \"value\": \"/data/project/patrocle\"}], \"volumeMounts\": [{\"mountPath\": \"/data/project\", \"name\": \"home\"}]}], \"volumes\": [{\"name\": \"home\", \"hostPath\": {\"path\": \"/data/project\", \"type\": \"Directory\"}}]}}, \"ttlSecondsAfterFinished\": 30, \"backoffLimit\": 1}}}}"

However, according to https://crontab.guru/#30_0_23_*_* this is a valid cron expression meaning “At 00:30 on day-of-month 23.” I am also able to run this cron on my personal machine.

Event Timeline

@Strainu can you check if that works if you replace the underscore with a dash? I suspect this is actually T305592 and jobs-framework-api miscategorizing the error it gets from kubernetes?