AlmaLinux / AlmaLinux/build-system

Keep track of background tasks statuses

Open
#259 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
32
Forks
11
PR merge metrics
No merged PRs in 30d

Description

We explored the possibility to keep track of background tasks that are sent.

This would involve:
- Creating a new table background_tasks in db that includes the build task (or release, or whatever task that is done through dramatiq), status and tiimestamp
- Create a small middleware that updates the records in the background_tasks table

The most interesting background tasks to track are the build-related ones, but can also be applied to anything we do with dramatiq.

Here’s a small example of the middleware we can create
```
class MyMiddleware(Middleware):
def after_process_message(self, _broker, _message, *, result=None, exception=None):
print("after_process_message, result:", result)

def before_process_message(self, _broker, _message):
print("before_process_message")

def after_enqueue(self, _broker, _message, _delay):
print("after_enqueue")

def before_enqueue(self, _broker, _message, _delay):
print("before_enqueue")

def before_ack(self, _broker, _message):
print("before_ack")

rabbitmq_broker = RabbitmqBroker(
url=f"amqp://:@:/",
middleware=[MyMiddleware()]
)
dramatiq.set_broker(rabbitmq_broker)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.