Bug 1117681 - new reporting query: system utilisation
Summary: new reporting query: system utilisation
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: reports
Version: 0.17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: 0.18
Assignee: Amit Saha
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-09 08:11 UTC by Dan Callaghan
Modified: 2018-02-06 00:41 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-04 05:41:17 UTC
Embargoed:


Attachments (Terms of Use)

Description Dan Callaghan 2014-07-09 08:11:03 UTC
A useful report is "utilisation" of particular systems: what proportion of a given time period where they reserved for. We currently have nothing covering that in our supported reporting queries, we should add it.

Here is a query I wrote for a user, in Teiid syntax:

    SELECT fqdn,
        CAST(SUM(TIMESTAMPDIFF(SQL_TSI_SECOND,
            CASE WHEN reservation.start_time < {ts '2014-07-01 00:00:00'}
                THEN {ts '2014-07-01 00:00:00'}
                ELSE reservation.start_time
                END,
            CASE WHEN reservation.finish_time IS NULL
                OR reservation.finish_time > {ts '2014-07-10 00:00:00'}
                THEN {ts '2014-07-10 00:00:00'}
                ELSE reservation.finish_time
                END))
            AS FLOAT)
        / TIMESTAMPDIFF(SQL_TSI_SECOND,
            {ts '2014-07-01 00:00:00'},
            {ts '2014-07-10 00:00:00'})
    FROM Beaker.reservation
    INNER JOIN Beaker.system
        ON reservation.system_id = system.id
    WHERE reservation.start_time >= {ts '2014-07-01 00:00:00'}
        AND (reservation.finish_time < {ts '2014-07-10 00:00:00'}
            OR reservation.finish_time IS NULL)
        -- add clauses here to select particular systems
    GROUP BY system.fqdn;

Comment 3 Amit Saha 2014-07-18 06:25:22 UTC
gerrit.beaker-project.org/#/c/3213/

Comment 4 Dan Callaghan 2014-08-06 05:52:36 UTC
The new reporting query is now available here:

https://git.beaker-project.org/cgit/beaker/tree/Server/bkr/server/reporting-queries/machine-utilization.sql?h=develop

Comment 5 xuezhi ma 2014-08-06 06:31:21 UTC
verified:

steps:
1. Get sql from https://git.beaker-project.org/cgit/beaker/tree/Server/bkr/server/reporting-queries/machine-utilization.sql?h=develop
2. Run the sql on database.
The sql can be run successfully.
3. Run the sql in description in teiid.
The sql can be run successfully too.

Change it to verified.

Comment 6 Dan Callaghan 2014-09-04 05:41:17 UTC
Beaker 0.18.0 has been released.


Note You need to log in before you can comment on or make changes to this bug.