VirtualBox

Ignore:
Timestamp:
Nov 23, 2020 10:31:51 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141473
Message:

testmanager/status.py: Try eliminating datetime dependency. bugref:9788

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/cgi/status.py

    r86951 r86953  
    3434import os
    3535import sys
    36 import datetime
    3736
    3837# Only the main script needs to modify the path.
     
    9291
    9392
    94 def find_test_duration(created):
    95     now = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc)
    96     diff = now - created
    97     days, seconds = diff.days, diff.seconds
    98     hours = days * 24 + seconds // 3600
    99     return hours
     93def timeDeltaToHours(oTimeDelta):
     94    return oTimeDelta.days * 24 + oTimeDelta.seconds // 3600
    10095
    10196
     
    108103        testbox_name = line[0]
    109104        test_result = line[1]
    110         test_created = line[2]
     105        oTimeDeltaSinceStarted = line[2]
    111106        test_box_os = line[3]
    112107        test_sched_group = line[4]
     
    122117
    123118        if test_result == "running":
    124             testboxes_dict[testbox_name].update({"hours_running": find_test_duration(test_created)})
     119            testboxes_dict[testbox_name].update({"hours_running": timeDeltaToHours(oTimeDeltaSinceStarted)})
    125120
    126121    return testboxes_dict;
     
    136131    elif testbox_os == "solaris":
    137132        dict_update(vb_dict, test_name + " / solaris", test_result)
    138 #    else:
    139 #        dict_update(vb_dict, test_name + " / other", test_result)
     133    else:
     134        dict_update(vb_dict, test_name + " / other", test_result)
    140135
    141136
     
    330325        #SELECT  TestBoxesWithStrings.sName,
    331326        #        TestSets.enmStatus,
    332         #        TestSets.tsCreated,
     327        #        CURRENT_TIME - TestSets.tsCreated,
    333328        #        TestBoxesWithStrings.sOS,
    334329        #        SchedGroupNames.sSchedGroupNames
     
    353348(   SELECT  TestBoxesWithStrings.sName,
    354349            TestSets.enmStatus,
    355             TestSets.tsCreated,
     350            CURRENT_TIME - TestSets.tsCreated,
    356351            TestBoxesWithStrings.sOS,
    357352            SchedGroupNames.sSchedGroupNames
     
    376371    SELECT  TestBoxesWithStrings.sName,
    377372            TestSets.enmStatus,
    378             TestSets.tsCreated,
     373            CURRENT_TIME - TestSets.tsCreated,
    379374            TestBoxesWithStrings.sOS,
    380375            SchedGroupNames.sSchedGroupNames
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette