The issues solved with a great help of Niphlod. I answered my own question 
on stackoverflow. 

please correct if it is not correct

http://stackoverflow.com/questions/34661782/web2py-function-not-triggered-on-user-request/34895532#34895532

Thank you 

On Monday, January 18, 2016 at 1:54:48 PM UTC+1, Niphlod wrote:
>
> "neverending" for this sake is "running for more than the usual timeout 
> imposed by webservers" which is 60 seconds.
>
> a task can be queued and also stopped via the scheduler APIs (queue_task 
> and stop_task) 
>
> On Monday, January 18, 2016 at 12:43:36 PM UTC+1, Yebach wrote:
>>
>> I do not think you can treat it as a never ending process. 
>>
>> There is a *.exe program that is started when user sends request, and 
>> also user stops it whenever he/she wants. I do not know how to treat this 
>> kind of process.I tried with scheduler but there was the same problem 
>>
>> I really need some help here.
>> Anyone?
>> Thank you
>>
>>
>> On Monday, January 11, 2016 at 8:47:45 PM UTC+1, Niphlod wrote:
>>>
>>> sooooooooooo. finally. 
>>> The external process is started from within web2py. 
>>> Which is handled by a webserver. 
>>> Which ALWAYS imposes a timeout.
>>> You can't start a neverending process inside a web request. That's why 
>>> long-running processes NEED to be managed OUTSIDE web2py (and why web2py 
>>> provides a nifty out-of-band processor called scheduler)
>>>
>>> PS: it was the first thing I said.
>>>
>>> On Monday, January 11, 2016 at 4:08:59 PM UTC+1, Yebach wrote:
>>>>
>>>> I went trough my code again
>>>>
>>>> This is the way i start my eternal process
>>>>
>>>> try:
>>>>        
>>>>         count = 0
>>>>         while ( count < 10 and ( os.path.isfile(outPath))):
>>>>             count += 1 
>>>>   
>>>>             os.remove(outPath)
>>>>             time.sleep(0.05)
>>>>         
>>>>         # Run woshi engine
>>>>         path_1 =  os.path.join(path, 'e1')
>>>>         os.chdir(path_1)
>>>>        
>>>>         p = subprocess.Popen(['woshi_engine.exe', scriptId], 
>>>> shell=True, stdout = subprocess.PIPE)
>>>>         
>>>>         return dict(status = 1)
>>>>
>>>> Is it possible this has an effect on the whole situation? But like I 
>>>> said. The problem is that while process is executing and woshi_engine.exe 
>>>> creates an txt file I read with a cirtain function, this function is not 
>>>> triggered, although the request comes to server.
>>>>
>>>>
>>>>
>>>>
>>>> 2016-01-11 14:17 GMT+01:00 Niphlod <nip...@gmail.com>:
>>>>
>>>>> I'm sorry but you need to rephrase your issue then. 
>>>>>
>>>>> On Monday, January 11, 2016 at 12:46:05 PM UTC+1, Yebach wrote:
>>>>>>
>>>>>> External process never drops dead. The request comes to server but 
>>>>>> sometimes, the function that reads the file, an external process created 
>>>>>> is 
>>>>>> not started. There are no issues with external process. 
>>>>>>
>>>>>>
>>>>>> 2016-01-08 17:23 GMT+01:00 Niphlod <nip...@gmail.com>:
>>>>>>
>>>>>>> so what's the issue with web2py if your external process sometimes 
>>>>>>> drops dead ? who starts the external process ?
>>>>>>>
>>>>>>> On Friday, January 8, 2016 at 12:32:20 PM UTC+1, Yebach wrote:
>>>>>>>>
>>>>>>>> It is external process
>>>>>>>>
>>>>>>>> 2016-01-08 11:04 GMT+01:00 Niphlod <nip...@gmail.com>:
>>>>>>>>
>>>>>>>>> you're missing the point. the "calculation" is running inside the 
>>>>>>>>> web2py environment or on an external process ?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thursday, January 7, 2016 at 8:58:04 PM UTC+1, Yebach wrote:
>>>>>>>>>>
>>>>>>>>>> The calculation runs on the same server. When user starts a 
>>>>>>>>>> calculation a function creates a txt file and puts it in a folder in 
>>>>>>>>>> my 
>>>>>>>>>> application. The engine checks if the file is there. if file exists 
>>>>>>>>>> it 
>>>>>>>>>> starts a calculation. The way user stops calculation another 
>>>>>>>>>> function 
>>>>>>>>>> actually deletes that file and that is it. But the refresh button or 
>>>>>>>>>> view 
>>>>>>>>>> button as we call it  (the function associated with ), just checks 
>>>>>>>>>> the out 
>>>>>>>>>> file engine produces. 
>>>>>>>>>>
>>>>>>>>>> How can I go around timeout? I am not sure I understand your 
>>>>>>>>>> answer
>>>>>>>>>>
>>>>>>>>>> Thank you
>>>>>>>>>>
>>>>>>>>>> On Thursday, January 7, 2016 at 8:40:05 PM UTC+1, Niphlod wrote:
>>>>>>>>>>>
>>>>>>>>>>> what are you to run the actual calculation ? because if you're 
>>>>>>>>>>> using the webserver, you may need to pay attention to the fact that 
>>>>>>>>>>> there 
>>>>>>>>>>> is ALWAYS a timeout imposed on the request coming in to avoid 
>>>>>>>>>>> runaway 
>>>>>>>>>>> calculations. 
>>>>>>>>>>>
>>>>>>>>>>> On Thursday, January 7, 2016 at 6:47:47 PM UTC+1, Yebach wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hello
>>>>>>>>>>>>
>>>>>>>>>>>> Using web2py (Version 
>>>>>>>>>>>> 2.8.2-stable+timestamp.2013.11.28.13.54.07), on 64-bit Windows, I 
>>>>>>>>>>>> have the 
>>>>>>>>>>>> following problem
>>>>>>>>>>>>
>>>>>>>>>>>> User triggers an engine that does some work and this engine 
>>>>>>>>>>>> creates an txt file with results. While engine is still 
>>>>>>>>>>>> calculating (engine 
>>>>>>>>>>>> is creating better and better results), user can check the current 
>>>>>>>>>>>> results, 
>>>>>>>>>>>> clicking on icon that provides a view (of course there is a 
>>>>>>>>>>>> controller 
>>>>>>>>>>>> function alos). These results are read from txt file. 
>>>>>>>>>>>>
>>>>>>>>>>>> Now some times while calculating this function is not 
>>>>>>>>>>>> triggered. I used Microsoft network monitor to monitor requests 
>>>>>>>>>>>> etc. I can 
>>>>>>>>>>>> see the request coming to server, but the function is not 
>>>>>>>>>>>> triggered.
>>>>>>>>>>>> Some time the first time the user clicks to check the result 
>>>>>>>>>>>> the function is triggered but on refresh again request comes to 
>>>>>>>>>>>> server but 
>>>>>>>>>>>> no results (meaning fucniton not triggered)
>>>>>>>>>>>> Any suggestions why these behavior ocures?
>>>>>>>>>>>>
>>>>>>>>>>>> Thank You
>>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>> Resources:
>>>>>>>>> - http://web2py.com
>>>>>>>>> - http://web2py.com/book (Documentation)
>>>>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>>>>> --- 
>>>>>>>>> You received this message because you are subscribed to a topic in 
>>>>>>>>> the Google Groups "web2py-users" group.
>>>>>>>>> To unsubscribe from this topic, visit 
>>>>>>>>> https://groups.google.com/d/topic/web2py/-ZHjMW2ke2o/unsubscribe.
>>>>>>>>> To unsubscribe from this group and all its topics, send an email 
>>>>>>>>> to web2py+un...@googlegroups.com.
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> Lep pozdrav 
>>>>>>>>
>>>>>>>> Vid Ogris
>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>> Resources:
>>>>>>> - http://web2py.com
>>>>>>> - http://web2py.com/book (Documentation)
>>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>>> --- 
>>>>>>> You received this message because you are subscribed to a topic in 
>>>>>>> the Google Groups "web2py-users" group.
>>>>>>> To unsubscribe from this topic, visit 
>>>>>>> https://groups.google.com/d/topic/web2py/-ZHjMW2ke2o/unsubscribe.
>>>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>>>> web2py+un...@googlegroups.com.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> Lep pozdrav 
>>>>>>
>>>>>> Vid Ogris
>>>>>>
>>>>>>
>>>>>> -- 
>>>>> Resources:
>>>>> - http://web2py.com
>>>>> - http://web2py.com/book (Documentation)
>>>>> - http://github.com/web2py/web2py (Source code)
>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>> --- 
>>>>> You received this message because you are subscribed to a topic in the 
>>>>> Google Groups "web2py-users" group.
>>>>> To unsubscribe from this topic, visit 
>>>>> https://groups.google.com/d/topic/web2py/-ZHjMW2ke2o/unsubscribe.
>>>>> To unsubscribe from this group and all its topics, send an email to 
>>>>> web2py+un...@googlegroups.com.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> Lep pozdrav 
>>>>
>>>> Vid Ogris
>>>>
>>>>
>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to