Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fields for tracking where jobs are executed #11597

Merged

Conversation

bjester
Copy link
Member

@bjester bjester commented Dec 6, 2023

Summary

Adds new fields to the jobs table which allow us to better reconcile the jobs with their status if worker execution is interrupted for some reason. These fields track:

  • the hostname of the worker
  • the process ID of the worker
  • the thread ID of the worker
  • any extra data the worker wants to track

References

Closes #9710

Reviewer guidance

There should be no perceptible change. The extra fields can be observed in the database, e.g.:

$ sqlite3 job_storage.sqlite3 
SQLite version 3.37.2 2022-01-06 13:25:41
Enter ".help" for usage hints.

sqlite> select id, func, state, worker_host, worker_process, worker_thread from jobs;
id                                func                                                          state      worker_host  worker_process  worker_thread  
--------------------------------  ------------------------------------------------------------  ---------  -----------  --------------  ---------------
d10e8b82fc8340a09dc886b53a841a46  kolibri.core.content.tasks.automatic_resource_import          COMPLETED  phlack       51781           140127435208256
1                                 kolibri.core.deviceadmin.tasks.perform_vacuum                 QUEUED     NULL         NULL            NULL           
streamed_cache_cleanup            kolibri.core.deviceadmin.tasks.streamed_cache_cleanup         QUEUED     NULL         NULL            NULL           
1000                              kolibri.core.discovery.tasks.reset_connection_states          QUEUED     phlack       51781           140127435208256
935d0c9cbb2ed6d2b971b26c6a3a2314  kolibri.core.discovery.tasks.add_dynamic_network_location     COMPLETED  phlack       51781           140127435208256
178d445f96e4ef5c8239edffc7e3472c  kolibri.core.discovery.tasks.perform_network_location_update  COMPLETED  phlack       51781           140127435208256
50                                kolibri.core.auth.tasks.soud_sync_processing                  QUEUED     phlack       51781           140127435208256
f870bab4a1884593bfc918f8d421ec1b  kolibri.core.auth.tasks.cleanupsync                           COMPLETED  phlack       51781           140120455886400
d660db3c63b846eebaad9bfd71bdc175  kolibri.core.content.tasks.automatic_resource_import          FAILED     phlack       51781           140120455886400
2dc8e34f08234f3bbdba42a6bd4bd48c  kolibri.core.auth.tasks.cleanupsync                           COMPLETED  phlack       51781           140127435208256
e38dd2e4c1f2456cb9aa94b7476dbb7d  kolibri.core.content.tasks.automatic_resource_import          FAILED     phlack       51781           140127435208256
0740f4d6436348a382a2dd5048b3c678  kolibri.core.auth.tasks.cleanupsync                           COMPLETED  phlack       51781           140120455886400
191b720c94c3410d980970d26eb85726  kolibri.core.content.tasks.automatic_resource_import          FAILED     phlack       51781           140120455886400


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... SIZE: small labels Dec 6, 2023
@bjester bjester force-pushed the worker-info-tracking branch from 4dfd8cc to fa282e9 Compare December 6, 2023 21:26
@bjester bjester added the TODO: needs review Waiting for review label Dec 12, 2023
@bjester bjester marked this pull request as ready for review December 12, 2023 19:34
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected!

@rtibbles rtibbles merged commit 018edda into learningequality:release-v0.16.x Dec 12, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV: backend Python, databases, networking, filesystem... SIZE: small TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store worker hostname and process id when jobs are picked up for execution by workers
2 participants