On Wednesday, March 5, 2014 3:49:22 PM UTC+1, Andrey K wrote:
>
> Greetings,
> I am using web2py scheduler and looking the way to get
> scheduler_run.traceback and scheduler_run.run_result for reporting.
> Any idea how I can get it?
> After I setting up the task by:
> task=scheduler.queue_task(test_js_task,pvars=dict(x))
> I can get only task.id and task.uuid.
>
That's because when you queue a task you don't have (yet) a scheduler_run
record. Moreover returning the result of the task to a "queueing" operation
is a tiddle bit a poor design (it's an async process!). However, there's
mysched.task_status(ref, output=False)
Ok, it's not documented in the book, but there are docstrings :P
Shortcut for task status retrieval
:param ref: can be
- integer --> lookup will be done by scheduler_task.id
- string --> lookup will be done by scheduler_task.uuid
- query --> lookup as you wish (as in db.scheduler_task.task_name
== 'test1')
:param output: fetch also the scheduler_run record
Returns a single Row object, for the last queued task
If output == True, returns also the last scheduler_run record
scheduler_run record is fetched by a left join, so it can
have all fields == None
>
> What is the way to get scheduler_run.id in order to get mentioned
> parameters?
>
assuming
task = mysched.queue_task(f, ....)
task_status = mysched.task_status(task.id, output=True)
traceback = task_status.scheduler_run.traceback
result = task_status.scheduler_run.run_result #or
result = task_status.result
> In addition I would like to add several extra fields to scheduler_task
> table - is it possible? If yes can you please tell me the way?
>
No, you can't and it's "by design". Scheduler tables are "tailored" to
contain only what's strictly needed to orchestrate web2py<-->worker
communications and worker<-->worker communications. Use a table with an id
referencing the task id or uuid ....
--
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.