AlmaLinux / AlmaLinux/build-system

Keep track of background tasks statuses

Aperta
#259 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Nessun dato sulla lingua
Stelle
32
Fork
11
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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)
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.