Hi,
I'm using the scheduler very heavily in my app and I found an
inconsistency in the Documentation.
The doc says that the best pratice to queue a task is to use:
db.scheduler_task._validate_and_insert
I think it should be *validate_and_insert* instead. Given the doc, the
validate_and_insert function does this:
"If validation does not pass the errors can be found in ret.error. If it
passes, the id of the new record is in ret.id. Mind that normally
validation is done by the form processing logic so this function is
rarely needed."
And given the source code of scheduler.py:
Field('group_name',default='main',writable=False), line 446
So the group_name is not writable for the form processing logic. This
causes this code:
db_scheduler.scheduler_task.validate_and_insert(
function_name='do_recommendation',
args=json.dumps([algorithm, userid, num_rec]),
group_name = 'recommendation',
timeout = 3600*24
)
db_scheduler.commit()
To have the group_name parameter ignored and insert to database as
'main' which is the default.
The workaround is to use *isert* instead of *validate_and_insert* but I
think at least one between the source code or the documentation should
be fixed.
Best Regards,
--
Vincenzo Ampolo
http://vincenzo-ampolo.net
http://goshawknest.wordpress.com
--