Difference between revisions of "Job Queue"

From MythTV Official Wiki
Jump to: navigation, search
(Job Queue in the SQL Database: Updated Type,Status. Added cmd,flags)
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Describe [[Job Queue]] here.
+
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:
 +
 +
{| border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse; border-color:silver; background:whitesmoke"
 +
|- style="background: gainsboro"
 +
!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:
 +
{| border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse; border-color:silver; background:whitesmoke"
 +
|- style="background: gainsboro"
 +
!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:
 +
{| border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse; border-color:silver; background:whitesmoke"
 +
|- style="background: gainsboro"
 +
!Cmds
 +
!Meaning
 +
|-
 +
|0
 +
|Run
 +
|-
 +
|1
 +
|Pause
 +
|-
 +
|2
 +
|Resume
 +
|-
 +
|4
 +
|Stop
 +
|-
 +
|8
 +
|Restart
 +
|}
 +
 +
The meaning of flags is as follows:
 +
{| border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse; border-color:silver; background:whitesmoke"
 +
|- style="background: gainsboro"
 +
!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:
 +
{| border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse; border-color:silver; background:whitesmoke"
 +
|- style="background: gainsboro"
 +
!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:
 +
<pre>
 +
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( ) , '', ''
 +
);
 +
</pre>
 +
 +
== [[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.
 
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.
  
Commercial flagging appears to be part of the Job Queue.  The status of the Job Queue is visible on mythweb under "Backend Status".
+
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]].
 +
 
 +
The below is a list of recognized keywords based on the 0.20 source.
 +
* DIR
 +
* FILE
 +
* TITLE
 +
* SUBTITLE
 +
* DESCRIPTION
 +
* HOSTNAME
 +
* CATEGORY
 +
* RECGROUP
 +
* PLAYGROUP
 +
* CHANID
 +
* STARTTIME
 +
* ENDTIME
 +
* STARTTIMEISO
 +
* ENDTIMEISO
 +
* PROGSTART
 +
* PROGEND
 +
* PROGSTARTISO
 +
* PROGENDISO
 +
* VERBOSELEVEL
 +
* JOBID
 +
* TRANSPROFILE
  
(this section needs a lot more work)
+
[[Category:Glossary]]

Revision as of 22:35, 28 December 2008

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.

The below is a list of recognized keywords based on the 0.20 source.

  • DIR
  • FILE
  • TITLE
  • SUBTITLE
  • DESCRIPTION
  • HOSTNAME
  • CATEGORY
  • RECGROUP
  • PLAYGROUP
  • CHANID
  • STARTTIME
  • ENDTIME
  • STARTTIMEISO
  • ENDTIMEISO
  • PROGSTART
  • PROGEND
  • PROGSTARTISO
  • PROGENDISO
  • VERBOSELEVEL
  • JOBID
  • TRANSPROFILE