Job Queue

From MythTV Official Wiki
Revision as of 02:27, 4 November 2015 by Llib (talk | contribs) (Replaced list with template)

Jump to: navigation, search

The Job Queue can be used to see the current state of Transcoding, Commercial Flagging, and User Jobs. The Job Queue can be viewed with the MythWeb plugin under "Backend Status" and also in the MythTV GUI at Information Center -> System Status -> Job Queue.

Job Queue in the SQL Database

When a job is scheduled, it appears as a new row in the jobqueue table in the mythconverg database. An example of the jobqueue table (as seen in an SQL table) is shown below:

id chanid starttime inserttime type cmds flags status statustime hostname args comment
2838 2045 2008-11-24 09:30:00 2008-11-24 21:32:48 512 0 0 1 2008-11-24 21:32:48 [BLOB - 0 B]
2837 2045 2008-11-24 10:30:00 2008-11-24 21:32:26 256 0 0 4 2008-11-24 21:32:26 mythbox [BLOB - 0 B]
2836 2045 2008-11-24 09:00:00 2008-11-24 21:31:09 256 0 0 272 2008-11-24 21:43:37 mythbox [BLOB - 0 B] Successfully Completed.
2835 2073 2008-11-24 21:00:00 2008-11-24 21:00:03 2 0 2 4 2008-11-24 21:45:12 mythbox [BLOB - 0 B] 74% Completed @ 37.0136 fps.

The type corresponds to the type of job that is in the Job Queue. Based on the above examples (compiled from starting several jobs in MythTV 0.20) the following list of types and their meanings has been created:

Type Meaning
0 System Job
1 Transcode
2 Commercial Flagging
256 User Job 1
512 User Job 2
1024 User Job 3
2048 User Job 4

The cmds is updated by the frontend job control commands. The meaning of cmds is as follows:

Cmds Meaning
0 Run
1 Pause
2 Resume
4 Stop
8 Restart

The meaning of flags is as follows:

Flags Meaning
0 No Flags
1 Use Cutlist
2 Live Recording
4 External

The status is updated by the particular job program, as well as the comment. i.e. If you write your own user job, it is your responsibility to read the cmds, perform the action and update the status/comment. The meaning of status is as follows:

Status Meaning
0 Unknown
1 Queued
2 Pending
3 Starting
4 Running (Commercial Flagging provides additonal information while running)
5 Stopping
6 Paused
7 Retry
8 Erroring
9 Aborting
256 Done
272 Finished (Successfully completed)
288 Aborted
304 Errored
320 Cancelled

hostname is updated by the backend. Probably when it is actually started on a backend system.

Furthermore, a job can be added to the queue not only through the MythTV user interface but also directly via MySQL insertion:

INSERT INTO `mythconverg`.`jobqueue` (
   `id` ,
   `chanid` ,
   `starttime` ,
   `inserttime` ,
   `type` ,
   `cmds` ,
   `flags` ,
   `status` ,
   `statustime` ,
   `hostname` ,
   `comment`
)
VALUES (
   NULL , '2045', '2008-11-24 09:30:00', NOW( ) , '256', '0', '0', '1', NOW( ) , '', ''
);

User Jobs

There are 4 customizeable jobs you can have in the job queue. These can be configured by running mythtv-setup. In mythfrontend, you can then configure myth to allow specific jobs to run on the host, as well as configure those jobs to run.

A custom job is simply a command that will be invoked after recording. For example, invoking ffmpeg to transcode your recording to a flash video file (FLV) for online streaming. The commands can be parameterized by using special keywords in the command. The keywords are in the form %WORD% and the job queue process will substitute in the appropriate values.

See more details about User Jobs.


} Note that not all parameters are available to all System Events User Jobs.
Parameters for System Events and User Jobs
Parameter Description Used

By

Released

In

%CARDID% Event
%CATEGORY% Program subject category, may be undefined. Both
%CHANID% Channel ID Both
%DESCRIPTION% Program title, may be undefined. Both
%DIR% Event: myth://IP:6543/file.mpg, Job: actual directory, may be undefined prior to recording start. Both
%ENDTIME% Recording end time (estimated) yyyyMMddhhmmss. Both
%ENDTIMEISO% YYYY-MM-DDThh:mm:ss Both
%ENDTIMEISOUTC% YYYY-MM-DDThh:mm:ssZ
%ENDTIMEUTC% yyyyMMddhhmmss Both
%EPISODE% Number Both 0.25?
%EVENTNAME% E.g. REC_PENDING Event
%FILE% Recording file, may be undefined prior to recording start. Both
%FINDID% Find ID, for DB lookups. Event
%HOSTNAME% Both
%INETREF% String, e.g. ttvdb.py_123456
%JOBID% The id of this job in the mythconverg jobqueue table.
%ORIGINALAIRDATE% Original Air Date of recording. Both
%PARENTID% Parent recording rule ID, for DB lookups. Event
%PARTNUMBER% Number
%PARTTOTAL% Number
%PLAYGROUP% Play group Both
%PROGEND% Program's scheduled end time. Both
%PROGENDISO% Both
%PROGENDISOUTC%
%PROGENDUTC% Both
%PROGSTART% Both
%PROGSTARTISO% Both
%PROGSTARTISOUTC%
%PROGSTARTUTC% Both
%REACTIVATE% 1 if this recording was reactivated after failing to start on time, 0 otherwise. Event
%RECGROUP% Recording group Both
%RECID% Recording rule ID, for DB lookups. Event
%RECORDEDID% Recorded rule ID, for DB lookups. Both v29.2
%RECSTATUS% Recording status as an integer for completeness, not currently useful. Event
%RECTYPE% This is the recording rule type as an integer, in the priming script example this could be used to do an extensive priming prior to some recordings and not others. These integers are listed in recordingtypes.h in the RecordingType enum. Event
%SEASON% Number Both 0.25?
%SECS% Time until upcoming recording starts. Event
%SENDER% Origin of event (hostname.) Event
%STARTTIME% Both
%STARTTIMEISO% Both
%STARTTIMEISOUTC%
%STARTTIMEUTC% Both
%SUBTITLE% Program subtitle, may be undefined. Both
%SYNDICATEDEPISODE% String
%TITLE% Program title, may be undefined. Both
%TRANSPROFILE% Profile number. Job
%TOTALEPISODES% Integer
%VBIDEVICE% E.g.: --verbose --logpath --loglevel --quiet --nodblog [--syslog (if non Windows)]. Event 30
%VERBOSELEVEL% Bit mapped decimal value. See: https://code.mythtv.org/cgit/mythtv/tree/mythtv/libs/libmythbase/verbosedefs.h Both
%VERBOSEMODE% E.g.: --verbose --logpath --loglevel --quiet --nodblog [--syslog (if non Windows)]. Job 0.25
%VIDEODEVICE% String identifying the physical video device Event 30