no, it's not. please read the relevant section on the book to get acquainted with the scheduler.
http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler On Tuesday, January 12, 2016 at 4:06:31 PM UTC+1, Yebach wrote: > > Hello > > I tried with sheduller > In model I created a file called scheduler.py > my code > > def runWoshiEngine(scriptId, path, outPath): > import os, sys > import subprocess > 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') > p = subprocess.Popen(['woshi_engine.exe', scriptId], shell=True, > stdout = subprocess.PIPE, cwd=path_1) > > > And in my controller function I did the following > > from gluon.scheduler import Scheduler > scheduler = Scheduler(db, dict(runFunction = runWoshiEngine(scriptId, > path, outPath))) > > Is this the right approach? and if it is how can I insert records in my db > for scheduler tables? > > Thank you > > 2016-01-12 15:14 GMT+01:00 Niphlod <nip...@gmail.com <javascript:>>: > >> use anything you like EXCEPT something inside the web environment. >> >> On Tuesday, January 12, 2016 at 2:01:37 PM UTC+1, Yebach wrote: >>> >>> Using cwdir helped to solve the problem with httpserver.log file. Thank >>> you for that >>> >>> So you suggest using scheduler to start my exe program? >>> >>> 2016-01-12 12:24 GMT+01:00 Niphlod <nip...@gmail.com>: >>> >>>> for this and the previous issue, you should be on the path "I won't >>>> never ever start a process inside a web request". >>>> That being said, subprocess.Popen has cwdir ......... >>>> >>>> On Monday, January 11, 2016 at 8:52:58 PM UTC+1, Yebach wrote: >>>>> >>>>> What do u suggest I use to startthe exe program. It takes one >>>>> parameter (script id)? >>>>> On Jan 11, 2016 8:50 PM, "Niphlod" <nip...@gmail.com> wrote: >>>>> >>>>>> you can't os.chdir in web2py. first it's not threadsafe. second, you >>>>>> screw up all web2py relative imports. >>>>>> >>>>>> BTW: httpserver.log is put on the same folder web2py.py is, unless >>>>>> you are using the -f parameter, in which case it sits in that directory, >>>>>> which is the one containing the "applications" folder. >>>>>> >>>>>> On Monday, January 11, 2016 at 4:06:38 PM UTC+1, Yebach wrote: >>>>>>> >>>>>>> Hello >>>>>>> >>>>>>> I have a strange behavior of my log file, or better to say the >>>>>>> location of my log file. >>>>>>> >>>>>>> If I understand correctly httpserver.log file is usually located in >>>>>>> application folder. >>>>>>> >>>>>>> When I have to run the engine the following code is executed >>>>>>> >>>>>>> path = applications/applicationName/engine/e1 >>>>>>> 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) >>>>>>> >>>>>>> After that the httpserver.log file is created in folder >>>>>>> applications/applicationName/engine/e1 and stays there >>>>>>> >>>>>>> Now if I run my second application in folder applications (like >>>>>>> production version) this file is moved to the engine folder of that >>>>>>> applicatio >>>>>>> >>>>>>> How can I set the default location of httpserver.log file and that >>>>>>> the file is not moved? >>>>>>> >>>>>>> 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/0WuC-Ahx0W0/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. >>>>>> >>>>> -- >>>> 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/0WuC-Ahx0W0/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/0WuC-Ahx0W0/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+un...@googlegroups.com <javascript:>. >> 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.