Python Forum
drawing a table with the status of tasks in each thread
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
drawing a table with the status of tasks in each thread
#4
Use a global dictionary to store status, and update it from each thread. Re-render the table in the main thread on a Timer to pick up changes.
Create a Queue and have each thread put status updates into it. Poll the queue in the main thread and update the table.
Use a thread-safe collections like concurrent.futures.Future to get status results and update the table.
Look into using a reactive framework like RxPy to handle concurrency and updating the table reactively.
The key things to watch out for are:

Updates to the Rich table need to happen on the main thread.
You'll need thread-safe data structures for sharing state between threads.
Avoid updating the table too rapidly - use small timers/delays.
I'd recommend looking into some examples using RxPy or reactive frameworks as they provide helpful abstractions for this kind of concurrent, live updating UI.
Reply


Messages In This Thread
RE: drawing a table with the status of tasks in each thread - by nerdyaks - Mar-01-2024, 09:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to script repetitive tasks in dynaform using python BenneGrus 0 1,396 Dec-22-2021, 08:36 AM
Last Post: BenneGrus
  asyncio: executing tasks + httpserver freebsdd 2 2,751 Aug-29-2020, 09:50 PM
Last Post: freebsdd
  Error SQLite objects created in a thread can only be used in that same thread. binhduonggttn 3 15,837 Jan-31-2020, 11:08 AM
Last Post: DeaD_EyE
  PYTHON - UNRAR : how can I build a thread to monitoring the downloading status Palerm0_24 2 2,689 Mar-18-2019, 02:25 PM
Last Post: Palerm0_24
  How to add asynchronous tasks as they are needed? AlekseyPython 2 4,134 Jan-11-2019, 02:58 AM
Last Post: AlekseyPython
  How I can limit quantity of parallel executable tasks in asyncio? AlekseyPython 1 2,492 Oct-24-2018, 10:22 AM
Last Post: AlekseyPython
  run two tasks concurrently tony1812 1 2,677 Jul-24-2017, 05:43 PM
Last Post: Larz60+
  Tasks for Python Lamon112 2 45,527 Jan-13-2017, 03:32 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020