Fixes: https://pagure.io/koji/issue/1382
Parsing the formatted time seems clunky and awkward when getTaskInfo returns these as timestamps also.
getTaskInfo
In the new formatTimeDifference function, you're dividing by 100 successively to get minutes and hours. That should be 60 unless I'm missing something. Also I think you can skip subtracting the seconds and minutes and instead just use integer division.
rebased onto a2a7983f36bcc74ca0747723ef19ac71dca02ea0
Updated - you're right. I've must been in some caffeine insufficiency state. (Maybe connected to that I wasn't able to easily determine some task length in the moment, so I've created this patch :-))
Traceback (most recent call last): File "/usr/share/koji-web/scripts/wsgi_publisher.py", line 378, in handle_request result = func(environ, **data) File "/usr/share/koji-web/scripts/index.py", line 694, in taskinfo return _genHTML(environ, 'taskinfo.chtml') File "/usr/share/koji-web/lib/kojiweb/util.py", line 156, in _genHTML return tmpl_inst.respond() File "taskinfo_chtml.py", line 1141, in respond NameMapper.NotFound: cannot find 'end_ts'
Looks like the value is not set for open tasks.
rebased onto 8f82c3b280e726fd749c0f7ee2a2ea344d4e7af4
Fixed + added descriptions.
Traceback (most recent call last): File "/home/mike/Devel/koji/koji/www/kojiweb/wsgi_publisher.py", line 378, in handle_request result = func(environ, **data) File "/home/mike/Devel/koji/koji/www/kojiweb/index.py", line 694, in taskinfo return _genHTML(environ, 'taskinfo.chtml') File "/home/mike/Devel/koji/koji/www/lib/kojiweb/util.py", line 154, in _genHTML return tmpl_inst.respond().encode('utf-8', 'replace') File "taskinfo_chtml.py", line 1140, in respond AttributeError: 'datetime.datetime' object has no attribute 'timestamp'
This appears to be a python3-ism. Since we're only doing this with now(), it's probably easiest to just use time.time() instead.
now()
time.time()
seems to work... https://github.com/mikem23/koji-playground/commits/pagure/pr/1383
2 new commits added
remove unneeded import
use time.time() for current timestamp
Cherry-picked + removed datetime import.
Commit f2eaa6cc fixes this pull-request
Pull-Request has been merged by mikem
Fixes: https://pagure.io/koji/issue/1382