I have a little program with different modules to make a decision in python. the requests are saved into an InQueue.csv
file. I am trying to invoke a python file named Monitoring.py
after modification to the InQueue.csv
file to do its responsibilities. Does anybody have any way to do this?
Asked
Active
Viewed 35 times
0

sshashank124
- 31,495
- 9
- 67
- 76

ali
- 1
- 4
-
a cron job that runs your python every minute and check for changes is one option. Have a python script run in the background that sleeps for x seconds and then checks the file again is another option. – marxmacher Jan 03 '20 at 07:21
-
this dogwatching method by the destination takes CPU usage and genegerally is the last option. the best method to do the job is invoking the destination by the source. tanks anyway pal. – ali Jan 03 '20 at 07:27
-
What is saving these requests to the .csv? – marxmacher Jan 03 '20 at 07:29
-
for this step of programming, it is saved in InQueue.csv by another little python code. but the final decision is the requests coming from different mobile users. – ali Jan 03 '20 at 07:33
-
cant you decorate the function that responds to the requests to call the other python bit to start after the request has been served for the mobile user? – marxmacher Jan 03 '20 at 07:35
-
the mentioned function can be written as an interface between InQueue.csv and Monitoring.py, but it is not intended to take much CPU by recursively executing. obviously, after invoking Monitoring.py, it in turn gets extra information of each request by p2p communication with the requester. – ali Jan 03 '20 at 07:49
-
I dont think you understood my question. Read it again please. Let it set for a while and then answer :) HINT: i was asking if the source side(as you said some python script is there) could invoke the Monitoring.py after a request has been server ( as i understand a request == change in .csv file, am i right?) – marxmacher Jan 03 '20 at 07:53
-
:) you are right (for the 'am i right?', :)) as i mentioned, in this step, a piece of python code fills the InQueue.csv, but latter it will be changed by some other python codes written for transacting between mobile users and InQueue.cs. for now, i am trying to find a command that could invoke the Monitoring.py. by the way, i am newcomer in python:) – ali Jan 03 '20 at 08:11
-
dear marxmacher, thanks for your contribution. i temporarily found runpy.run_path to cope with the problem. latter, i will ask you and the others to help me in finding a way to transact between the python code and the mobile users. thanks again. – ali Jan 03 '20 at 08:54