Skip to content

Remove cron job details for CreateEmptyEmbeddingsRecordsWorker

What does this MR do and why?

This MR removes cron job details for CreateEmptyEmbeddingsRecordsWorker that was previously removed in !149473 (merged). However, the cron has not been cleaned up, hence job are still scheduled.

See #438337 (comment 1886713690)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Local gdk may be in accurate since any data resets after the worker removal will mean that it is difficult to simulate the data to be removed.

  1. Add the data (from sample in gstg gitlab-com/gl-infra/production#17919 (comment 1886656357))
gdk redis-cli -n 1 
>  redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> hset cron_job:llm_embedding_gitlab_documentation_create_empty_embeddings_records_worker "symbolize_args" "0" "date_as_argument" "false" "name" "llm_embedding_gitlab_documentation_create_empty_embeddings_records_worker" "queue_name_prefix" "" "cron" "0 5 * * 1,2,3,4,5" "last_enqueue_time" "2024-04-30 05:00:01 +0000" "status" "enabled" "queue_name_delimiter" "" "description" "" "args" "[]" "klass" "Llm::Embedding::GitlabDocumentation::CreateEmptyEmbeddingsRecordsWorker" "message" "{\"retry\":3,\"queue\":\"default\",\"version\":0,\"queue_namespace\":\"cronjob\",\"class\":\"Llm::Embedding::GitlabDocumentation::CreateEmptyEmbeddingsRecordsWorker\",\"args\":[]}" "source" "dynamic" "active_job" "0"
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> zadd cron_job:llm_embedding_gitlab_documentation_create_empty_embeddings_records_worker:enqueued 1714626000 "2024-05-02T05:00:00Z"
(integer) 1
  1. Run migration using bin/rails db:migrate RAILS_ENV=development or rerun (if you're trying again) using:
➜  gitlab git:(sc1-remove-createemptyembeddingsrecordsworker-cron) bin/rails db:migrate:redo:main VERSION=20240502044605 RAILS_ENV=development
main: == [advisory_lock_connection] object_id: 124220, pg_backend_pid: 11708
main: == 20240502044605 RemoveCreateEmptyEmbeddingsRecordsWorker: reverting =========
main: == 20240502044605 RemoveCreateEmptyEmbeddingsRecordsWorker: reverted (0.1422s)

main: == [advisory_lock_connection] object_id: 124220, pg_backend_pid: 11708
main: == [advisory_lock_connection] object_id: 124860, pg_backend_pid: 11742
main: == 20240502044605 RemoveCreateEmptyEmbeddingsRecordsWorker: migrating =========
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: == 20240502044605 RemoveCreateEmptyEmbeddingsRecordsWorker: migrated (0.0074s)

main: == [advisory_lock_connection] object_id: 124860, pg_backend_pid: 11742
  1. Verify that cron is removed
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]> zrange cron_job:llm_embedding_gitlab_documentation_create_empty_embeddings_records_worker:enqueued 0 -1 withscores
(empty array)
redis /Users/sylvesterchin/work/gitlab-development-kit/redis/redis.socket[1]>  hgetall cron_job:llm_embedding_gitlab_documentation_create_empty_embeddings_records_worker
(empty array)
Edited by Sylvester Chin

Merge request reports