-
Notifications
You must be signed in to change notification settings - Fork 5
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
Release/1.23.0 #143
Release/1.23.0 #143
Conversation
Add priorities to tasks published using RabbitMQ
last_updated timestamp for the status API (RabbitMQ impl)
…ys open (#148) * Rework connection creation * Remove commented code * Increase logging verbosity around RabbitMQ connections * Increase log severity for temporary logging messages * Log RabbitMQ connection re-establishing on debug
On the topic of |
@stchris on the topic of the
[1] - so, previously, in the |
* Keep rmq channels open * Account for test queue not being there
This fixes an issue with the metric for failed tasks and also adds test coverage for the metrics. Follow up to #181
* Reproduce incorrect dataset timestamps alephdata/aleph#3787 * Remove "end_time" timestamp We currently do not retain information about inactive datasets (i.e. datasets that do not have any more pending or running tasks). For this reason, the "end_time" timestamp is currently of no use, as it would never be displayed to users anyway. While there are some plans around providing more detail about the results of processed tasks as well as completed jobs, it is unclear where this data will be stored and what the implementation will look like. As it is easy enough to add this information back (< 10 LOC), I’ve removed it for now. * Only set `start_time` timestamp if it hasn’t been set yet * Delete dataset timestamps when all tasks have been processed * Add tests covering dataset status when cancelling tasks * Extract flushing status data into separate method * Ensure time-machine is installed in GitHub Actions * Delete dead code * Remove redundant code `cleanup_dataset_status` iterates over all active datasets and removes status information if it is done (i.e. there are no more pending or running tasks). It is called by the Aleph worker periodically. We already do this for individual datasets whenever a task from the dataset is done or the dataset is cancelled as a whole. That means that `cleanup_dataset_status` is redundant. Also see: #190 (comment) * Use `is_done` helper method * Fix linter errors --------- Co-authored-by: catileptic <[email protected]>
This reverts commit 85d8544.
* Fix Redis keys (temporary solution) * Fix unused variable (linter) * Fix double increment bug, remove deprecated key from test * Bump version: 1.23.0-rc34 → 1.23.0-rc35 * Execute redis commands at the end of mark_task_for_retry * Bump version: 1.23.0-rc35 → 1.23.0-rc36 * Remove wrong keys clean-up code * Fix failing tests
This introduces several changes to the way
servicelayer
exposes a RabbitMQ-based implementation for Aleph tasks.Objects
Task
A data class that contains information about one Aleph task.
Also contains methods to track how many times the task was retried.
Dataset
Object which keeps track of the status of currently running tasks by populating Redis. One
Dataset
instance corresponds to onecollection_id
. This is also the object which the/status/
API ends up querying to populate its response.Redis keys used by the
Dataset
object:tq:qdatasets
: set of allcollection_id
s of active datasets (a dataset is considered active when it has either running or pending tasks)tq:qdj:<dataset>:taskretry:<task_id>
: the number of timestask_id
was retriedAll of the following keys refer to
task_id
s or statistics about tasks per a certain dataset (collection_id
):tq:qdj:<dataset>:finished
: number of tasks that have been marked as "Done" and for which an acknowledgement is also sent by the Worker over RabbitMQ.tq:qdj:<dataset>:running
: set of alltask_id
s of tasks currently running. A "Running" task is a task which has been checked out, and is being processed by a worker.tq:qdj:<dataset>:pending
: set of alltask_id
s of tasks currently pending. A "Pending" task has been added to a RabbitMQ queue (via abasic_publish
call) by a producer (an API call, a UI action etc.).tq:qdj:<dataset>:start
: the UTC timestamp when either the firsttask_id
has been added to a RabbitMQ queue (so, we have our first Pending task) or the timestamp when the firsttask_id
has been checked out (so, we have our first Running task). Thestart
key is updated when the first task is handed to a Worker.tq:qdj:<dataset>:last_update
: the UTC timestamp from the latest change to the state of tasks running for a certaincollection_id
. This is set when: a new task is Pending, a new task is Running, a new task is Done, a new task is canceled.tq:qds:<dataset>:<stage>
: a set of alltask_id
s that are either running or pending, for a certain stage.tq:qds:<dataset>:<stage>:finished
: number of tasks that have been marked as "Done" for a certain stage.tq:qds:<dataset>:<stage>:running
: set of alltask_id
s of tasks currently running for a certain stage.tq:qds:<dataset>:<stage>:pending
: set of alltask_id
s of tasks currently pending for a certain stage.Worker
The parent class of all workers used in aleph: the Aleph worker, the
ingest-file
worker. Handles the consuming of tasks from RabbitMQ queues, and sending acknowledgements when the tasks are completed. Thedispatch_task
method is implemented in each subsequent child class.Changes from the initial RabbitMQ implementation
servicelayer
.tq:qds:<dataset>:<stage>
(stage_key
),tq:qds:<dataset>:<stage>:finished
,tq:qds:<dataset>:<stage>:running
,tq:qds:<dataset>:<stage>:pending
and added code toget_status
to expose a break-down of tasks per stage. Thejob_id
key is set tonull
since jobs are no longer relevant. The key was preserved in the JSON in order to not introduce breaking changes.get_rabbitmq_connection
has been refactored and it will now re-establish a new RabbitMQ connection is the existing one was closed.Other changes
The status API JSON response has been modified, introducing a breaking change. The jobs key has been removed from the JSON. Now, the JSON contains a total number of running, pending and finished tasks, as well as a break-down of these tasks per stage.