Академический Документы
Профессиональный Документы
Культура Документы
Two types of Control Agents control the execution of the application. 1. Supervisory Control Agent 2. Subordinate Control Agent
Broker Agent consults the Grid Information Services (GRIS/GIIS, MDS of Globus) to obtain informations about the available resources that is obtained using the Ganglia Information provider for MDS and prepares Resource Specification Table (RST) for Resource Providers willing to provide computational service. The collection of several such templates is known as Resource Specification Table (RST). The following figures show an initial implementation for JRL Template and Resource Specification Template.
JRL
RST
The Matching Agent then receives the JRL and the Resource Specification Template for matching Since the Resource Specification Template obtained is not well formatted it is transformed into a useable format so that it can be easily matched with the JRL obtained It is done using the PrintXmlhost.java program provided at the end of the chapter The Resource Specification Template thus obtained so that it can be easily matched with JRL is shown in the snapshot below
THE NEW RST Next when we prepare RST, JRL and Resource Specification Table (RST) are matched. Matching agent then prepares and sends the Agreement offer to the appropriate Resource Provider. After getting the acknowledgement from the Resource Provider, URI of Resource Provider (list) is sent to the Supervisory Control Agent of Job Controller (in Client). Broker Agent finds out the suitable resources with ability of meeting the requirements of the submitted job. Broker Agent then prepares the Agreement offer with the help of JRL and the Resource Specification Template and sends that agreement offer to the Resource Provider. After getting the acknowledgement from the Resource Provider it send URI of the Resource Provider along with the agreement (it can also send the list of Resource Provider which match the job requirements for future use) to the Supervisory Control Agent of Job Controller.
7.4 Analyzer
The Analyzer component monitors individual resources and gathers performance-monitoring data regarding application execution, as well as infrastructure functioning. The application performance analysis data consists of an evaluation of performance properties and identification of regions showing performance problems. The global part of the Analyzer also maintains an integrated view of the monitoring data obtained from individual resources. This helps in identifying any performance bottleneck in the system. This component is the Analysis Agent.
The java program which formats the Resource specification Template into a useable format PrintXmlhost.java import java.io.*; import org.xml.sax.*; import org.xml.sax.helpers.*; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; public class PrintXmlhost extends DefaultHandler { private int indent =0; private String spacer(int count) { String temp=""; for(int i=0;i<count;i++) temp+= " "; return temp; } public void startDocument() throws SAXException { try { OutputStream f= new FileOutputStream("host.xml"); String s= "<?xml version =\"1.0\"?>"; byte buf[]=s.getBytes(); f.write(buf); System.out.println("<?xml version =\"1.0\"?>"); } catch (IOException e) { System.out.println("sorry"); } } public void startElement( String uri, String eleName, String raw, Attributes attributes) throws SAXException { System.out.print(spacer(indent) + "<" + eleName+">" ); if(attributes != null ) for(int i=0;i<attributes.getLength();i++) System.out.println("<"+ attributes.getLocalName( i )+" > " +attributes.getValue( i )+"</"+ attributes.getLocalName(i)+">"); //System.out.println( ">" ); indent +=3; }
public void endElement ( String uri, String eleName, String raw ) throws SAXException { indent -=3; System.out.println(spacer(indent) + "</" + eleName + ">"); } public void characters(char buffer[], int offset, int length ) throws SAXException { if( length > 0 ){ String temp = new String(buffer, offset, length); if( !temp.trim().equals( "" )) System.out.println( spacer(indent) + temp.trim() ); } } public void procesingInstruction( String target, String value ) throws SAXException { System.out.println( spacer(indent) + "<?" + target + " " + value + "?>"); } public static void main( String args [] ) { try{ XMLReader saxParser = ( XMLReader ) Class.forName("org.apache.xerces.parsers.SAXParser").newInstance(); saxParser.setContentHandler(new PrintXmlhost() ); FileReader reader = new FileReader( args[ 0 ] ); saxParser.parse( new InputSource( reader ) ); } catch ( SAXParseException spe ) { System.err.println( "Parse Error: " + spe.getMessage() ); } catch (SAXException se) { se.printStackTrace(); } catch (Exception e)
{ e.printStackTrace(); } System.exit(0); }}