Python Forum
Multiprocessing doesn't seem to work?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiprocessing doesn't seem to work?
#11
(Feb-13-2020, 05:14 PM)DeaD_EyE Wrote: The question is, what happens if receiver runs before sender?
Your problems goes deeper as you think. The whole structure is wrong.

I think a Queue can solve this problems.
Writing to a file and reading it from another process is very fragile.

You're right, I think sub-process is what I really need to be using.

A couple things: I do need a queue feature, I just have no idea how to implement a queue. As the program currently is, anything submitted when my program isn't running simply isn't sent. When I start my program up, it simply pulls the newest submission for both sending & receiving and processes that. So anything that isn't the newest submission is then lost.

But regarding 'what happens if receiver starts before sender'- in the most basic sense, they function independently from one another. Sender takes submissions posted to a table in a db and sends the newest one (checking for new every 1 second)... receiver simply iterates through a list of conversations and checks each one for new replies. They can function on their own if only one is running. However- like you noticed, if the sender isn't running, the list that the receiver reads from and iterates through will not get updated with new conversations to check replies for. But in the end, it doesn't matter which program starts first... just that they're both running.

Though I do recognize that my program, as it currently is, is very fragile and a huge maintenance liability. Basically I'm the only one who would be able to support it just because I'm the one who created it and I know all the things that could go wrong and where to look for issues.

You're right in that I do need to implement queueing, and ditch the reading from/writing to text files.

Also thank you for the input, it really is helpful. As you might have noticed, I'm no dev/python guru... merely trying to get better.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UART Serial Read & Write to MP3 Player Doesn't Work bill_z 16 5,640 18 minutes ago
Last Post: Ronaldweera
  Multiprocessing: Threads work well. Processes don't work. viyubu 11 1,664 Dec-03-2023, 08:50 PM
Last Post: snippsat
  Why doesn't calling a parent constructor work with arbitrary keyword arguments? PurposefulCoder 4 870 Jun-24-2023, 02:14 PM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 1,680 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  color code doesn't work harryvl 1 841 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  client.get_all_tickers() Doesn't work gerald 2 1,655 Jun-16-2022, 07:59 AM
Last Post: gerald
  pip doesn't work after Python upgrade Pavel_47 10 4,050 May-30-2022, 03:31 PM
Last Post: bowlofred
  For Loop Works Fine But Append For Pandas Doesn't Work knight2000 2 1,929 Dec-18-2021, 02:38 AM
Last Post: knight2000
  Class Method to Calculate Age Doesn't Work gdbengo 1 1,657 Oct-30-2021, 11:20 PM
Last Post: Yoriz
  Process doesn't work but Thread work ! mr_byte31 4 2,555 Oct-18-2021, 06:29 PM
Last Post: mr_byte31

Forum Jump:

User Panel Messages

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