[mythtv-users] User Job status reporting
Raymond Wagner
raymond at wagnerrp.com
Sun Jan 19 02:32:57 UTC 2014
On 1/18/2014 9:12 PM, Yan Seiner wrote:
>
> On 01/18/2014 05:50 PM, Raymond Wagner wrote:
>> On 1/18/2014 7:02 PM, Yan Seiner wrote:
>>> I'm working with a transcoding script and I notice that the
>>> myth-supplied jobs have nice status while mine shows an exit status and
>>> a wrong "Errored". The job finished fine and returned a code of '0'.
>>> I've looked at the sample user scripts provided in the wiki and I can't
>>> find any coding magic that would do that..... How do I get my reporting
>>> to look like that of the native myth jobs?
>>>
>>> Mine -> Transcode (Errored: Sat Jan 18, 2014, 03:33 PM) exit status 0,
>>> job status was "Starting"
>>> Myth -> Flag Commercials (Finished: Sat Jan 18, 2014, 12:20 PM) 5
>>> commercial breaks
>>> Myth -> Look up Metadata (Finished: Sat Jan 18, 2014, 12:02 PM) Metadata
>>> Lookup Complete.
>>
>> Manually insert that nice status message into the database. Make sure
>> you update your numerical status as well, or the jobqueue will
>> overwrite the message when it updates the number.
>>
>> If you read python, take a look at mythvidexport.py; particularly the
>> following lines.
>
> Apparently not well enough.....
>
> Is there a plain sql version of the status insertion?
mysql> desc jobqueue;
+--------------+--------------+------+-----+---------------------+
| Field | Type | Null | Key | Default |
+--------------+--------------+------+-----+---------------------+
| id | int(11) | NO | PRI | NULL |
| chanid | int(10) | NO | MUL | 0 |
| starttime | datetime | NO | | 0000-00-00 00:00:00 |
| inserttime | datetime | NO | | 0000-00-00 00:00:00 |
| type | int(11) | NO | | 0 |
| cmds | int(11) | NO | | 0 |
| flags | int(11) | NO | | 0 |
| status | int(11) | NO | | 0 |
| statustime | timestamp | NO | | CURRENT_TIMESTAMP |
| hostname | varchar(64) | NO | | |
| args | blob | NO | | NULL |
| comment | varchar(128) | NO | | |
| schedruntime | datetime | NO | | 2007-01-01 00:00:00 |
+--------------+--------------+------+-----+---------------------+
#define JOBSTATUS_MAP(F) \
F(JOB_UNKNOWN, 0x0000, JobQueue::tr("Unknown")) \
F(JOB_QUEUED, 0x0001, JobQueue::tr("Queued")) \
F(JOB_PENDING, 0x0002, JobQueue::tr("Pending")) \
F(JOB_STARTING, 0x0003, JobQueue::tr("Starting")) \
F(JOB_RUNNING, 0x0004, JobQueue::tr("Running")) \
F(JOB_STOPPING, 0x0005, JobQueue::tr("Stopping")) \
F(JOB_PAUSED, 0x0006, JobQueue::tr("Paused")) \
F(JOB_RETRY, 0x0007, JobQueue::tr("Retrying")) \
F(JOB_ERRORING, 0x0008, JobQueue::tr("Erroring")) \
F(JOB_ABORTING, 0x0009, JobQueue::tr("Aborting")) \
/* \
* JOB_DONE is a mask to indicate the job is done no matter what the \
* status \
*/ \
F(JOB_DONE, 0x0100, JobQueue::tr("Done (Invalid status!)")) \
F(JOB_FINISHED, 0x0110, JobQueue::tr("Finished")) \
F(JOB_ABORTED, 0x0120, JobQueue::tr("Aborted")) \
F(JOB_ERRORED, 0x0130, JobQueue::tr("Errored")) \
F(JOB_CANCELLED, 0x0140, JobQueue::tr("Cancelled")) \
When the job terminates and the jobqueue handles the termination, it
will update the "status" flag to one of JOB_FINISHED or JOB_ERRORED, and
set an appropriate "comment". If you set the status flag to the correct
value ahead of time before terminating the application, you can set a
comment and it will not be overwritten by the jobqueue.
More information about the mythtv-users
mailing list