Hi Simone, Thanks for your reply. I used the solution from the web2py document site: http://www.web2py.com/books/default/chapter/29/13/deployment-recipes, in section "Start the scheduler as a Linux service (upstart)". After I started it, the status check (sudo status web2py-scheduler) shows that it is already started: ubuntu@ip-172-31-41-2:~$ sudo status web2py-scheduler web2py-scheduler start/running, process 16262
Interesting thing is that when I restart web2py-scheduler again, it works out. The previous worker didn't show up in the db_scheduler_worker table but the current one shows up. May I have another question? We are planning to use the power of distributed system cluster with multiple EC2 instances for this project. May I ask if the tasks in the scheduler just use different thread in a CPU or it can also be designed to use different cores or nodes with multiple processors? (From this post: https://groups.google.com/forum/#!topic/web2py/WlhvelFu8-Q, it seems the scheduler can be adapted for multiple cores). And if that is the case, is there any special design on web2py scheduler itself for the communication between master instance and others? Thanks a lot! On Tuesday, September 30, 2014 3:04:07 AM UTC-4, Niphlod wrote: > > if there are no records in the scheduler_worker, the scheduler is not > running. Please check your "permanent daemon" solution to see if it's > running and what it logs. > > On Monday, September 29, 2014 4:37:53 PM UTC+2, Pengfei Yu wrote: >> >> Hi, >> >> I have a web application hosted on AWS EC2 with Apache2. I plan to use >> web2py scheduler for some heavy tasks with user input files. Now I only use >> some small tasks like "wc -c" to test the functions of scheduler. It seems >> that the submitted tasks are always QUEUED and the status never changes. >> After searching the google group, I added "db.commit()" right after >> "scheduler.queue_task()", but it still cannot work. >> >> I've already Installed the scheduler as a permanent daemon on Linux and >> started "web2py-scheduler" using "sudo start web2py-scheduler". >> >> Here is part of my codes in default.py: >> def index(): >> >> response.flash = T("Welcome to web2py!") >> form=SQLFORM(db.project,fields=['name', >> 'Genome',"File_type","InputFile"]) >> if request.vars.InputFile!=None and >> request.vars.InputFile.filename.split(".")[-1]!=request.vars.File_type: >> response.flash = 'The input file must match file type, please >> fill again' >> return dict(form=form) >> if request.vars.InputFile!=None: >> form.vars.processID="0" >> if form.process().accepted: >> response.flash = 'form accepted' >> filepath = form.vars.InputFile >> command = "wc -c >> /home/www-data/web2py/applications/BamToVcf/uploads/"+filepath >> p = scheduler.queue_task('run',[command]) >> db.commit() >> row = db(db.project.InputFile==filepath).select().first() >> row.update_record(processID = p.uuid) >> redirect(URL("progress",args=[p.uuid])) >> elif form.errors: >> response.flash = 'form has errors' >> else: >> response.flash = "please fill out the form" >> return dict(form=form) >> >> >> def progress(): >> processID = request.args(0) >> project = db.project(db.project.processID==processID) >> status=scheduler.task_status(processID,output=True) >> start_time = utc_to_local(status.scheduler_task.start_time) >> return dict(project=project,p=status,start_time=start_time) >> >> def list(): >> rows = db(db.project.id>0).select() >> return dict(rows=rows) >> >> And the code in scheduler.py in Models folder: >> from gluon.scheduler import Scheduler >> import subprocess >> from collections import OrderedDict >> import os >> >> def run(command): >> p = subprocess.Popen(command, >> shell=False, >> stdout=subprocess.PIPE, >> stderr=subprocess.PIPE) >> startTime = time.time() >> stdout, stderr = p.communicate() >> endTime = time.time() >> return (command, p.returncode, stdout, stderr, round(endTime - >> startTime)) >> >> def demo2(a,b): >> return a+b >> >> scheduler = Scheduler(db,dict(run=run,demo2=demo2)) >> >> From the database page ("~/%app/appadmin/index"), I can see the records >> of tasks in db.scheduler_task table but no record in db.scheduler_worker >> and db.scheduler_run table. >> >> Could any one help me figure out the problem? >> >> Thanks very much! >> >> >> -- 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/d/optout.

