macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Distributed Tiger: Xgrid Comes of Age
Pages: 1, 2, 3, 4, 5

Setting Up a Controller

The next piece of the Xgrid puzzle is the controller. Because most of us do not run Mac OS X Server, I am going to take you through setting up an Xgrid controller on the client version of Mac OS X Tiger. Apple hasn't gone out of its way to make setting up this controller obvious, but it can be accomplished with a few well-chosen commands in Terminal. If the command line is completely alien to you, you might consider using XgridLite, which achieves the same end result with a more user-friendly graphical interface.



The command-line tool xgridctl can be used to stop and start the controller and/or the agent. If you are familiar with the command-line interface to the Apache Web Server (i.e., apachectl), xgridctl should seem familiar, because it operates in a very similar manner. Simply open the Terminal application, and enter the following command to start the Xgrid controller:


drew pbook: sudo xgridctl c start

Enter your password when requested. Note that you need to be an administrator of your Mac to start the controller, and issue commands as the superuser, which explains the use of sudo. The c in the command indicates that you wish to send a command to the controller, rather than the agent, for which you use the letter a. The command itself comes last, in this case start. Other options include stop and restart. For a complete overview of xgridctl, see the man page by entering the following in terminal:


drew pbook: man xgridctl

The Xgrid Admin Tool

One of Apple's best kept secrets is that it gives away a piece of Mac OS X Server for free. Some of the Server administration tools can be downloaded here. The Xgrid Admin tool is included in this suite, which can be used to log in to an Xgrid controller, and monitor its activities. I suggest you download the tools, install, and then take a peek in /Applications/Server. Start the Xgrid Admin tool, and when prompted for a controller, choose the one on your Mac that you started above.

The Xgrid Admin tool provides a summary of the activity of any controller or grid that you select in the table view on the left. The Overview tab gives you the current capacity of the controller or grid, how many jobs are running, how many are pending, and so forth. The Agents tab is used to find out which agents are connected and what they are doing, and the Jobs tab shows the status of all jobs that are pending, running, or have run on the controller or grid in question.

The Xgrid Admin tool.
The Xgrid Admin tool.

It can help your understanding of the inner workings of Xgrid considerably if you monitor what happens in the Xgrid Admin tool as you submit jobs to the Xgrid controller. When you are learning to use the Xgrid command-line client in the next section, I suggest you occasionally take a peek at the Xgrid Admin tool, and observe its response to the various requests from the client.

The xgrid Command-Line Client

The last element of Xgrid is the client. The client submits jobs to the controller, which then arranges for them to be run on one of the available agents. Apple only supplies one client application--aside from the example projects mentioned earlier--the command-line tool xgrid. You use xgrid not only for job submission, but also for querying grid status. To make sure your controller is running, and find out which grids are available, you can issue this command:


drew pbook: xgrid -grid list
{gridList = (0); }

The output is in property list format. An array of list identifiers is returned for the key gridList; in this case the array only contains a single number, 0, which is the identifier for the default grid on the controller.

To query the status of one of the grids in the list, you simply issue a command like the following:


drew pbook: xgrid -grid attributes -gid 0
{gridAttributes = {gridMegahertz = 0; isDefault = YES; name = Xgrid; }; }

The -grid option indicates that xgrid is to retrieve the attributes of one of the grids hosted by the controller, and -gid identifies the grid in question, in this case that with identifier 0. Various pieces of information are returned, including whether the grid is the controller's default or not (isDefault), the name of the grid (name), and the current workload (gridMegahertz).

Pages: 1, 2, 3, 4, 5

Next Pagearrow