tobymao/saq

History of completed tasks on the web?

KirVelikiyy opened this issue · 2 comments

Hi! i am facing a problem using SAQ and i don't know where to find the answer. so i decided to open the issue. if there is some community i would be glad to join. i am new to SAQ and i haven't figured out how everything works here yet.

When I try to run examples (like examples/simple.py), in the web application the shuffles have a non-unique id - cron:cron_job.

As a consequence, there is no way to view details of completed tasks.

what can be done?
image

I'd like to share my experience customizing SAQ:

To conveniently store and investigate job results, I override Queue.serialize, adding the ability to send the job data to a queue for saving it in MongoDB. This way, I always store the current state of the job in the database, and I can perform search operations, filters, etc.

def serialize(self, job: Job) -> str:
    job_dict = job.to_dict()
    if self.persist_task_send_stream:
        self.persist_task_send_stream.send_nowait(job_dict)
    return self._dump(job_dict)

With jobs saved in the database, it's easy to create a custom UI to your needs.

not in scope for now but happy to accept a well crafted design and pr.