Thank Niphlod for your answer. it is already great if it is possible even
theoretically!
Regarding implementation. Correct me please if I am wrong in following
understanding - am I right that I need to:
1)copy the whole web2py and myapp with necessary libs to another server .
2)set up db connection in the 2nd box's web2py myapp to remote DB (first
server) like:
db= DAL('postgres://postgres:[email protected]/test', lazy_tables=False,
migrate=True, fake_migrate=False)
3) run web2py scheduler on the second box as:
web2py.py -K appname
Is that all???It is sounds like magic!!!!
How the second server job scheduler get understanding of calling task?
If it works I wonder how to control what server (not worker) get next task
- like what should I put in the model to force job be assigned to the the
box I want?
If my understanding is wrong please give me more details or an example.
Thanks a lot for your help, Niphlod!!!
Just in case here is my code:
*db.py*
db = DAL('postgres://postgres:[email protected]/test',
lazy_tables=False, migrate=True, fake_migrate=False)
from gluon.scheduler import Scheduler
scheduler = Scheduler(db)
*defatul.py*
from tool_task import
test_js_tasktask=scheduler.queue_task(test_js_task,pvars=dict(inFileId=inFileId,outDirId=outDirId,cmdLine=cmdLine,me
=me1))
*tool_task.py*
def test_js_task(inFileID,outDirID,cmdLine,me):
subprocess.call(cmdLine.split(), stdout=subprocess.PIPE)
On Friday, February 28, 2014 10:59:06 PM UTC+3, Niphlod wrote:
>
> the scheduler is designed also to support such cases. You can spin off
> whatever no. of workers you want from wherever you'd like. The only thing
> that needs to be reachable is the database where the scheduler tables are.
> you'll just have to copy your web2py folder (all the framework, plus the
> app(s)) in another server.
> If that one is just doing the "additional scheduler" role, instead of
> starting the webserver, you'll start the worker with web2py.py -K appname
>
> On Friday, February 28, 2014 12:05:22 PM UTC+1, Andrey K wrote:
>>
>> Good day,
>> I am working on the application that requires run background scripts on
>> user demand.
>> At the moment I have implemented it as native web2py job scheduler. If
>> the demand will be high enough my server would not be able deliver all
>> tasks in reasonable time. Thus I am looking the way to destribute tasks to
>> many servers or to cluster. I wonder what is the best practice for such a
>> task? Is there a way to run web2py scheduler instances on different servers
>> while distributing tasks from web2py app to these sheduler instances?
>> Any ideas or directions to the solution would be very appreciated. Thank
>> you in advance.
>> Kind regards, Andrey
>>
>
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.