ucsf-wynton / wynton-tools

0 stars 0 forks source link

How to find hostnames with resource flag 'x86-64-v' of a certain value #13

Open HenrikBengtsson opened 6 months ago

HenrikBengtsson commented 6 months ago

With XSLT stylesheet qhost_filter_x86-64-v.xsl:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
    <xsl:param name="value"/>
    <!-- Template to match the root element -->
    <xsl:template match="/qhost">
        <!-- Preserve the qhost wrapper in the output -->
            <!-- Match <host> elements with the specific <resourcevalue> child -->
            <xsl:for-each select="host[resourcevalue[@name='x86-64-v' and starts-with(text(), $value)]]">
                <!-- Output the value of the 'name' attribute -->
<xsl:value-of select="@name"/>
<xsl:text>
</xsl:text>
            </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

we can find all execution hosts with x86-64-v=2 as:

$ xsltproc --stringparam value '2' qhost_filter_x86-64-v.xsl <(qhost -F x86-64-v -xml)
msg-id11
msg-id12
msg-id13
msg-id4
msg-id5
msg-id6
msg-id7
msg-id8
msg-id9
msg-ihgpu1
msg-ihgpu2
msg-ihgpu4
msg-ihgpu5
msg-iogpu1
msg-iogpu2
msg-iogpu3
msg-iogpu4
msg-iogpu5
msg-iogpu6
msg-iogpu7
msg-iogpu8