All,
I can not get the scheduler to work. In particular I am trying to
updated objects in the DB via sqlobject, but the changes are never
committed.
I added these lines to the startup.py file:
================================================
from foo.asyncJobs.schedule import schedule
turbogears.startup.call_on_startup.append(schedule)
================================================
This is the foo.asyncJobs file:
================================================
from turbogears.scheduler import add_interval_task
import sgresultsdb.asyncJobs.asyncJobProcessor as asyncJobProcessor
def schedule():
add_interval_task(action =asyncJobProcessor.checkForJobsAndRunThem,
taskname="jobProcess",
initialdelay=0,
interval=10)
================================================
And this is the async.asyncJobProcessor file
================================================
from sqlobject import *
def checkForJobsAndRunThem():
import foo.shared.SgResultsDBConstants as SRDBC
from foo.asyncJobs.udpateTaskIssue import UpdateTaskIssueRunner
NAME_TO_TASK_MAPPING = {SRDBC.INHERIT_ISSUE_JOB:UpdateTaskIssueRunner}
from sgresultsdb.model import AsyncJob
print "Checking for Jobs .."
listOfJobs = list(AsyncJob.select(AsyncJob.q.active ==
1).orderBy(AsyncJob.q.issueDate ))
if len(listOfJobs ) == 0:
print "No Jobs Present"
else:
for aJob in listOfJobs:
if not aJob.type in NAME_TO_TASK_MAPPING:
print "No job definition for :",aJob.type
else:
# run the job
jobRunner =
NAME_TO_TASK_MAPPING[aJob.type](aJob)
jobRunner.runJob()
print "RAN THE JOB"
aJob.active = 0
aJob.syncUpdate()
print "Done processing Jobs"
================================================
I never see though attribute on the job being set to 0 in the DB.
What is going on here?
Thanks
kavika
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---