GridSafeDocumentation/ReportTemplates/Filters/

Filters

Every report uses data from some sub-set of the available usage records in the system. You can control which records to include in the report using Filters.

The 'fil' namespace needs to be defined in the Report.

<rep:Report 
  xmlns:rep="http://safe.epcc.ed.ac.uk/report"
  xmlns:par="http://safe.epcc.ed.ac.uk/parameter"
  xmlns:per="http://safe.epcc.ed.ac.uk/period"
  xmlns:fil="http://safe.epcc.ed.ac.uk/filter">

Filters

The most basic and useful type of Filter is a EQ, equals, Filter where all the usage records where a sting Property matches a certain Value are selected. The example below selects all the usage records where the Institute is Digital Communications.

<fil:Filter>
        <fil:EQ>
                <fil:Property>Institute</fil:Property>
                <fil:Value>Digital Communications</fil:Value>
        </fil:EQ>
</fil:Filter>

There are also filters types.

  • NE - not equal to
  • GT - greater than
  • LT - less than
  • GE - greater than or equal to
  • LE - less than or equal to

Below show a show a numeric filter which select all the records where the jobs waited for longer than 30 minutes.

<fil:Filter>
        <fil:GT>
                <fil:Property>CPUWait</fil:Property>
                <fil:Value>1800</fil:Value>
        </fil:GT>
</fil:Filter>

Combining Filters

Filters can be combined using And tags. The example below selects all the records where the jobs were submitted by someone who's Institute is Digital Communications and waited for longer than 30 minutes but less than 60 minutes.

<fil:Filter>
        <fil:And>
                <fil:EQ>
                        <fil:Property>Institute</fil:Property>
                        <fil:Value>Digital Communications</fil:Value>
                </fil:EQ>
                <fil:GT>
                        <fil:Property>CPUWait</fil:Property>
                        <fil:Value>1800</sel:Value>
                </fil:GT>
                <fil:LT>
                        <fil:Property>CPUWait</fil:Property>
                        <fil:Value>3600</sel:Value>
                </fil:LT>
        </fil:And>
</fil:Filter>

Multiple filters may exist in a report. The record set active at any point in their report is defined by an AND combination of the filters directly inside the current XML element or any of its ancestors.

<fil:Filter>

                <fil:EQ>
                        <fil:Property>Institute</fil:Property>
                        <fil:Value>Digital Communications</fil:Value>
                </fil:EQ>
</fil:Filter>
         <section>
<fil:Filter>

                <fil:GT>
                        <fil:Property>CPUWait</fil:Property>
                        <fil:Value>1800</sel:Value>
                </fil:GT>
</fil:Filter>
         </section>

         <section>
<fil:Filter>

                <fil:LT>
                        <fil:Property>CPUWait</fil:Property>
                        <fil:Value>1800</sel:Value>
                </fil:LT> 
</fil:Filter>
          </section>


In the above example both sections will see the first filter, but the first section will select wait time greater than 1800 seconds while the second section will select wait time less than 1800 seconds.

Producers

By default the usage records tables are pulled from the accounting.tables property set in the service-config.properties file. Reports can select records from other tables by means of the Producer tag.

<fil:Filter>
        <fil:Producer>allocation</fil:Producer>         
        <fil:EQ>
                <fil:Property>Project</fil:Property>
                <fil:Value>prdatlas</fil:Value>
        </fil:EQ>               
</fil:Filter>

The example above uses the allocation producer. There is an allocation.tables property defined in service-config.properties which signifies the tables manager by this producer.

TimeBounds

Most data-generation elements (e.g. tables and graphs) also apply an implicit filter based on the reporting time-period that is currently in scope. This defaults to a filter that selects records where the property CompletedTimestamp occurs within the period. This behaviour can be customised using the TimeBounds element.

<fil:Filter>
        <fil:TimeBounds><fil:Alltimes/></fil:TimeBounds>         
</fil:Filter>

This disables the implicit filter.

<fil:Filter>
        <fil:TimeBounds><fil:Property>MyTime</fil:Property></fil:TimeBounds>         
</fil:Filter>

This selects records where the property MyTime occurs within the period

<fil:Filter>
        <fil:TimeBounds>
           <fil:StartProperty>MyStart</fil:StartProperty>
           <fil:EndProperty>MyEnd</fil:EndProperty>
        </fil:TimeBounds>         
</fil:Filter>

This selects records which overlap with the period. MyStart is the property that defines the start of the record. MyEnd is the property that defines the end of the record. For most data-generation elements this also enables overlap calculations where values are scaled based on the degree of overlap between the record and the period. This is important for reports where the record lengths are comparable to the length of the reporting period but is less intuitive than selecting on a single property value.

 

Grid-SAFE was funded by JISC and is maintained, developed, and managed by EPCC at the University of Edinburgh