[GE users] xml-qstat on Cocoon/Tomcat

butters chris at pearit.co.uk
Wed Nov 24 14:05:37 GMT 2010


    [ The following text is in the "iso-8859-1" character set. ]
    [ Your display is set for the "ISO-8859-10" character set.  ]
    [ Some special characters may be displayed incorrectly. ]

Thanks very much for your help Mark, I was able to get the CGI script working. In case its of help to anyone, here's the block of sitemap code I ended up with to do this;

  <map:match pattern="cluster/*/jobinfo">
    <!--
        | This section redirects requests for the status of an individual job to a cgi script.
        | This cgi script is expected to return output equivalent to that of 'qstat -xml',
        | which is then transformed with an XSL file to produce the page seen by the user.
    -->
    <map:generate  type="request" />
    <map:transform src="xsl/cocoon/redirect-query.xsl">
        <map:parameter name="clusterName" value="{1}" />
        <map:parameter name="baseURL"
            value="http://server.fqdn.local/cgi-bin/qstat.cgi?arg={request:queryString}"
            />
    </map:transform>
    <map:transform type="xinclude"/>
    <map:transform src="xsl/qstatj-xhtml.xsl">
        <map:parameter name="clusterName" value="{1}" />
        <map:parameter name="timestamp"   value="{date:yyyy-MM-dd_HH:mm:ss}"/>
    </map:transform>
    <map:serialize type="xhtml"/>
  </map:match>

It's not perfect, for some reason I have to hardcode the server name to make it work (comes back with a message about needing white space between public and private names when I use '{request:serverName}'), but it does the trick for the moment.

I'll definitely investigate getting off Cocoon and switching to HTTPi, or perhaps even Apache itself, in the mid-term, as you suggested. But for now I can at least deliver a first release of xml-qstat on time!

Thanks again,
Chris

On 22 November 2010 13:28, olesen <Mark.Olesen at faurecia.com<mailto:Mark.Olesen at faurecia.com>> wrote:
> Can you (or anyone else) offer me any pointers or examples as to how
> to call a CGI script with parameters (e.g. http://server/cgi-
> bin/qstat.cgi?cell=chbs&root=/data/sge62&job=12558) from the sitemap
> file please?

There's likely a better way, but for this sort of thing I've used an xinclude transformation to tap in from other sources.
Below is a snippet from the sitemap that shows this in action.

Of course, since your source maybe hard-coded, you won't need an xsl to generate the corresponding xi:xinclude element ... you can just have it directly defined. Squirreling it away in config/config.xml and extracting it via an xsl might be the easiest though.

 <map:match pattern="qstatf~default.xml">
   <map:select type="resource-exists">
   <map:when test="cache/qstatf.xml">
     <map:generate src="cocoon:/cache/qstatf.xml"/>
   </map:when>
   <map:otherwise>
     <!--
        | fetch from "/<webapp>/qstatf.xml/~{sge_cell}/{sge_root}" via xinclude
        | (Note: the input xml is irrelevant)
        -->
     <map:generate  type="request" />
     <map:transform src="xsl/cocoon/redirect-query.xsl">
       <map:parameter name="clusterName" value="default" />
       <map:parameter name="resource"    value="qstatf.xml" />
       <map:parameter name="baseURL"
           value="http://{request:serverName}:{request:serverPort}/{request:sitemapURIPrefix}"
           />
     </map:transform>
     <map:transform type="xinclude"/>
   </map:otherwise>
   </map:select>
   <map:serialize/>
 </map:match>



/mark



DISCLAIMER:
This electronic transmission (and any attachments thereto) is intended solely for the use of the addressee(s). It may contain confidential or legally privileged information. If you are not the intended recipient of this message, you must delete it immediately and notify the sender. Any unauthorized use or disclosure of this message is strictly prohibited. Faurecia does not guarantee the integrity of this transmission and shall therefore never be liable if the message is altered or falsified nor for any virus, interception or damage to your system.

------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=297621

To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net<mailto:users-unsubscribe at gridengine.sunsource.net>].





More information about the gridengine-users mailing list