User Job reports error but completes

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

User avatar
bill6502
Developer
Posts: 2307
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: User Job reports error but completes

Post by bill6502 »

The standard DB port is 3306, but your user's is set to 0 (see: <Port>0</Port>
in your diff above.)

I'd change that in your home directory/.mythtv/config.xml and retry.

EDIT: a value of 0 should automatically select 3306
Espry0n
Newcomer
Posts: 11
Joined: Fri Jan 26, 2018 4:16 pm
United States of America

Re: User Job reports error but completes

Post by Espry0n »

bill6502 wrote:
Thu Feb 01, 2018 4:16 pm
The standard DB port is 3306, but your user's is set to 0 (see: <Port>0</Port>
in your diff above.)

I'd change that in your home directory/.mythtv/config.xml and retry.
He's also missing a condition and a code to emit. I don't know about an EOF marker too i.e.

If condition x:
Then emit status code
else condition Y:
do this
EOF
User avatar
dizygotheca
Developer
Posts: 267
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: User Job reports error but completes

Post by dizygotheca »

Depends on your Menu Theme. One of these should work for you.

For Default: Main Menu->Information Centre->System Status->4th Tab
For Classic: Main Menu->TV->System Status->...
For DVR: Main Menu->System Status->...
For Media Centre: Main Menu->Advanced->System Status->...

https://www.mythtv.org/wiki/User_Manual ... ion_Center
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: User Job reports error but completes

Post by daraden »

for the "Ocean Treks" recording you posted earlier the command would look like

Code: Select all

/home/mythtv/transcode-h264-v2.py --chanid 1501 --starttime 20180127143000 --tzoffset 7
the chanid and starttime are used to identify the recording you wish to interact with in the database. In the case of this script you can use one of two formats for the starttime a UTC timestamp("2018-01-27T14:30:00Z+07:00") or the format used in the filename(20180127143000). tzoffset is needed for the second option because the script converts it into the UTC timestamp and needs to add the +07:00 missing from the filename.
rlongfield
Junior
Posts: 28
Joined: Tue Oct 11, 2016 4:35 pm
Bahamas

Re: User Job reports error but completes

Post by rlongfield »

I tried to run the script from the command line

Code: Select all

/home/mythtv/transcode-h264-v2.py --chanid 1501 --starttime 20180113143000 --tzoffset 7
and I got the following output:
chanid "1501"
utcstarttime "2018-01-13 21:30:00-05:00"
Traceback (most recent call last):
File "/home/mythtv/transcode-h264-v2.py", line 681, in <module>
main()
File "/home/mythtv/transcode-h264-v2.py", line 675, in main
runjob(chanid=opts.chanid, starttime=opts.starttime, tzoffset=opts.tzoffset)
File "/home/mythtv/transcode-h264-v2.py", line 172, in runjob
rec = Recorded((chanid, utcstarttime), db=db);
File "/usr/lib/python2.7/dist-packages/MythTV/dataheap.py", line 342, in __init__
DBDataWrite.__init__(self, data, db)
File "/usr/lib/python2.7/dist-packages/MythTV/database.py", line 318, in __init__
DBData.__init__(self, data, db)
File "/usr/lib/python2.7/dist-packages/MythTV/database.py", line 180, in __init__
self._pull()
File "/usr/lib/python2.7/dist-packages/MythTV/database.py", line 388, in _pull
DBData._pull(self)
File "/usr/lib/python2.7/dist-packages/MythTV/database.py", line 204, in _pull
raise MythError('DBData() could not read from database')
MythTV.exceptions.MythError: DBData() could not read from database
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: User Job reports error but completes

Post by daraden »

Your tzoffset should currently be -5 for The Bahamas. For some reason when i previously did the math my brain assumed 9:30pm.

Check your recording directory for the recording file(1501_20180113143000.ts). If the recording is set to start early it may be slightly different.

Daylight savings time can also be an issue with the tzoffset, it needs to be set to the value from the time of the recording.
rlongfield
Junior
Posts: 28
Joined: Tue Oct 11, 2016 4:35 pm
Bahamas

Re: User Job reports error but completes

Post by rlongfield »

The script is running correctly so far with the correct timezone offset.
We'll see what the results are in a few hours.

Thanks for the help so far!
rlongfield
Junior
Posts: 28
Joined: Tue Oct 11, 2016 4:35 pm
Bahamas

Re: User Job reports error but completes

Post by rlongfield »

So My command line encoding finished and I got this result:

Command Run:

Code: Select all

/home/mythtv/transcode-h264-v2.py --chanid 1501 --starttime 20171230143000 --tzoffset -5
values ['frame=86380', 'fps=4.2', 'q=29.0', 'size=859394kB', 'time=00:24:00.09', 'bitrate=4888.7kbits/s', ''] (
framenum = 86380 fps = 4.20
Progress 100% encoding 4.2 frames per second ETA 0 mins
Read no lines of ffmpeg output for 0 secs. Possible hang?
Read no lines of ffmpeg output for 10 secs. Possible hang?
res = "[None]"
Traceback (most recent call last):
File "/home/mythtv/transcode-h264-v2.py", line 681, in <module>
main()
File "/home/mythtv/transcode-h264-v2.py", line 675, in main
runjob(chanid=opts.chanid, starttime=opts.starttime, tzoffset=opts.tzoffset)
File "/home/mythtv/transcode-h264-v2.py", line 519, in runjob
os.remove(infile)
OSError: [Errno 2] No such file or directory: '/Media/MythTV/Recordings/1501_20171230143000.ts'
And the output of

Code: Select all

echo $?
is
1
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: User Job reports error but completes

Post by daraden »

It is crashing when trying to delete the original/commercial edited file.

is '/Media/MythTV/Recordings/1501_20171230143000.ts' the correct full path to the recording file?

What OS are you using?
rlongfield
Junior
Posts: 28
Joined: Tue Oct 11, 2016 4:35 pm
Bahamas

Re: User Job reports error but completes

Post by rlongfield »

That is what I thought too but the file isn't in the directory anymore.

/Media/MythTV/Recordings is the correct location.

Ubuntu 16.04
User avatar
bill6502
Developer
Posts: 2307
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: User Job reports error but completes

Post by bill6502 »

Around line 519 in the file, look for a line like: os.remove(infile).
Make it look like this:

Code: Select all

    if os.path.isfile(infile):
        os.remove(fname)
That will prevent this error, but there may be more.

Out of curiosity, what does this return (run on the backend))

Code: Select all

curl --silent --header Accept:Application/json localhost:6544/Myth/GetSetting?Key=SaveTranscoding\&HostName=_GLOBAL_
rlongfield
Junior
Posts: 28
Joined: Tue Oct 11, 2016 4:35 pm
Bahamas

Re: User Job reports error but completes

Post by rlongfield »

The results of

Code: Select all

curl --silent --header Accept:Application/json localhost:6544/Myth/GetSetting?Key=SaveTranscoding\&HostName=_GLOBAL_
is:
{"String": "0"}
Thing I noticed that the .tmp files are not being deleted. Looking at the code to make the change suggested it looks to me like the .tmp files are not being deleted because of the error I'm getting. I could totally be wrong on this though.

I'm running another transcode to see what happens.

Thanks for the assist thus far!
rlongfield
Junior
Posts: 28
Joined: Tue Oct 11, 2016 4:35 pm
Bahamas

Re: User Job reports error but completes

Post by rlongfield »

So the job I started last night has completed

Code: Select all

/home/mythtv/transcode-h264-v2.py --chanid 1501 --starttime 20180106143000 --tzoffset -5
and this is the end result
Progress 100% encoding 4.1 frames per second ETA 0 mins
values ['frame=76447', 'fps=4.1', 'q=29.0', 'size=714121kB', 'time=00:21:14.52', 'bitrate=4590.0kbits/s', '']
framenum = 76447 fps = 4.10
Read no lines of ffmpeg output for 0 secs. Possible hang?
res = "[None]"
Duration 00:21:14.99
Duration ['00', '21', '14.99']
Duration in seconds "1274.99"
Duration in milliseconds "1274990"
When I do a

Code: Select all

echo $?
I got this:
0
I also checked and the .tmp file for the 1501_20180106143000 file was deleted.

I'm going to kick off a transcode job from mythweb but I think this is solved now?!?
rlongfield
Junior
Posts: 28
Joined: Tue Oct 11, 2016 4:35 pm
Bahamas

Re: User Job reports error but completes

Post by rlongfield »

So from mythweb the encoding completed and gave me a summary showing the compression % but didn't say it had completed successfully.
I started another transcode and when I checked this morning it said "Error: User Job returned non-zero" for the transcode that completed yesterday.

I'm running another job from the command line and I'll do an echo $? to see the output.

It looks like it's actually completing just fine and that it just isn't reporting nicely to Myth. Which in the end isn't a hug deal...
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: User Job reports error but completes

Post by daraden »

It may not seem like a huge deal now, but after you have used it a few dozen times and find out what is broken it could be. Of course it could be its just not setting the return code properly.

You could try changing the end of the script to look like this

Code: Select all

    if len(args) == 1:
        runjob(jobid=args[0])
        sys.exit(0)
    elif opts.chanid and opts.starttime and opts.tzoffset is not None:
        runjob(chanid=opts.chanid, starttime=opts.starttime, tzoffset=opts.tzoffset)
        sys.exit(0)
    else:
        print 'Script must be provided jobid, or chanid, starttime and timezone offset.'
        sys.exit(1)

if __name__ == '__main__':
    main()

Code: Select all

sys.exit(0)
should set the return code to 0 if the rest of the script runs without error
Post Reply