Distributed Tiger: Xgrid Comes of Age
Pages: 1, 2, 3, 4, 5
A footnote on the format of the property list: you can also use XML property lists, but they tend to be more verbose. You can also easily convert a property list to XML format using the plutil command. To convert the batch.plist file, for example, you simply issue the following command:
drew pbook: plutil -convert xml1 batch.plist
This replaces the contents of the batch.plist file with the XML below, which contains exactly the same information.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>jobSpecification</key>
<dict>
<key>applicationIdentifier</key>
<string>com.apple.xgrid.cli</string>
<key>inputFiles</key>
<dict/>
<key>name</key>
<string>Sleepy Calendar</string>
<key>submissionIdentifier</key>
<string>abc</string>
<key>taskSpecifications</key>
<dict>
<key>0</key>
<dict>
<key>arguments</key>
<array>
<string>3</string>
<string>2005</string>
</array>
<key>command</key>
<string>/usr/bin/cal</string>
</dict>
<key>1</key>
<dict>
<key>arguments</key>
<array>
<string>20</string>
</array>
<key>command</key>
<string>/bin/sleep</string>
</dict>
<key>hi</key>
<dict>
<key>arguments</key>
<array>
<string>Hi Mom!</string>
</array>
<key>command</key>
<string>/bin/echo</string>
</dict>
</dict>
</dict>
</dict>
</plist>
Setting Up a Secure Xgrid
To this point we have largely ignored the issue of security. If this doesn't bother you, you can happily skip this section. But if it does worry you, it is possible to use password authentification with the Xgrid controller supplied in the client version of Tiger, although Apple hasn't gone out of its way to make it easy to configure. The problem is, there isn't any straightforward means of entering the controller's passwords.
A controller has two passwords: one for agents, and one for clients. These passwords need to be stored in a special format in the files /etc/xgrid/controller/agent-password and /etc/xgrid/controller/client-password, but you'll probably find these files are missing from your file system. Luckily, Brian Granger discovered a simple way to create these files, and posted his solution to the Xgrid mailing list, so what follows is thanks to Brian.
The controller password files may not exist on Mac OS X client, but the agent files do. You create them whenever you enter a password in the Xgrid configuration pane of System Preferences. So the trick to getting password files for the controller is simply to copy the ones created for the agent.
The first thing you have to do is set a password for your agent. You do this like so:
- Open the Sharing pane in System Preferences.
- Select the Services tab, and then the Xgrid row of the table view.
- Press the Configure... button.
- Select the Password authentication method from the pop-up button, and enter a password.
- Click the OK button.
There should be a file containing the agent password at the path /etc/xgrid/agent/controller-password. The file is called controller-password because it is the password used to authenticate the agent to a controller.
Now that you have a correctly formatted password file, you can simply copy it to the correct path for the controller passwords, like so:
sudo cp /etc/xgrid/agent/controller-password \
/etc/xgrid/controller/agent-password
sudo cp /etc/xgrid/agent/controller-password \
/etc/xgrid/controller/client-password
(Note that you have to be an administrator to do this; you will be prompted for your account password.) The controller now has one password file to authenticate the agent, and one to authenticate the client. In this case, the passwords are all the same, because we simply copied the same file for each. If you want different passwords, you could change the agent password in the System Preferences multiple times, and after each change, copy the password file, but for most a single password will suffice.
At this point you have to edit the property list of the controller so that it uses password authentication. Open the file /Library/Preferences/com.apple.xgrid.controller.plist, and change the entries for the AgentAuthentication and ClientAuthentication keys to Password, rather than None. It should end up looking something like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AgentAuthentication</key>
<string>Password</string>
<key>ClientAuthentication</key>
<string>Password</string>
</dict>
</plist>
With all the configuration complete, all you have to do is restart the agent and controller. For the agent, you can either open the System Preferences Sharing pane and stop and start the Xgrid agent, or you can enter the following command:
drew pbook: sudo xgridctl a restart
For the controller, you can enter this:
drew pbook: sudo xgridctl c restart
To test that everything went according to plan, try submitting one of the xgrid jobs above, using the -p option to provide the controller password.
If you find all of this tiresome, you might like to try Ed Baskerville's XgridLite tool, which was mentioned earlier. It can do it all at the touch of a button.
Until Next Time...
That completes our introduction to setting up Xgrid, and using the command-line xgrid tool. Next time, we will leave Terminal and take a look at the Cocoa API to Xgrid. To spice things up a bit, we will draw on a couple of other Tiger technologies--Automator and Core Image--to build an Xgrid-enabled, image-processing tool. See you then.
Drew McCormack works at the Free University in Amsterdam, and develops the Cocoa shareware Trade Strategist.
Return to the Mac DevCenter
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 12 of 12.
-
Unable to see Agents
2005-09-21 07:52:17 Sean_Murphy [Reply | View]
Hi - I may have found the answer elsewhere OTW. There is an XgridWiki that states that ports 4111-4120 & 49200-49500 must be open to allow comm's. I will try this this evening and see how we go. If you have any suggestions pls. do forward them here.
Regards
Sean
-
Not seeing Agents
2005-09-21 07:22:00 Sean_Murphy [Reply | View]
Hi - First Up - Thanks for the article I have been itching to try Xgrid out.
However, I am not seeing any additional agents. I have started the agents via 'Sharing' with no pwd. I have started the controller via XGridLite but when I pull up the Xgrid Admin I see only the agent for the controller machine.
Any thoughts? Obvious gotcha's I may have missed?
-
Controller Authentification Erratum
2005-08-24 14:38:57 drewmccormack [Reply | View]
It seems I may have left out an important piece of information regarding configuring the controller. I assumed the default authentifcation method was 'None', when it may actually be 'Password'.
If you want to start a controller without password authentification, you need to edit the controller configuration file, which is/Library/Preferences/com.apple.xgrid.controller.plist. Change the authentication method toNone, and then restart the controller with the commandsudo xgridctl c restart(orstartif it is not running). -
'Authentification' Erratum
2005-08-24 14:44:55 drewmccormack [Reply | View]
I wish Safari text boxes had automatic spell checking ... 'authentification' is not a word. Please read 'authentication' in my previous post.
Drew
-
Broken example
2005-08-24 11:44:45 IslandDan [Reply | View]
It would be nice if this worked but it doesn't. Probsably the author has some thiongs setup that a stock instsall of 10.4.2 doesn't. Or perhaps Apple just doesn't have it together yet. The second command fails: xgrid -grid list just printing it's help.
Sad. -
Broken example
2005-08-25 00:42:40 cparnot [Reply | View]
you have to have a controller (xgrid server) running, and have the environment variable mentioned in the text set, or use the '-h' flag, for instance:
xgrid -h localhost -grid list
(assuming there is no password set and the server is run on the machine you are logged in) -
Broken example
2005-08-25 00:50:16 drewmccormack [Reply | View]
Yes, thanks Charles. It seems I may have unwittingly had environment variables set without realizing it.
As Charles points out, probably the easiest thing to do is add the-hoption to yourxgridcommands.
Drew -
Broken example
2005-08-27 11:11:44 jfconway [Reply | View]
First - thanks for the Xgrid walk-through. It does perhaps need some amendments, however, and even amendments to the amendments! I couldn't get the example to work until I added the -password option, so the working command becomes:
xgrid -hostname localhost -password <whatever> -grid list
I feel that I am making progress and I thank you again for the article that got me started. -
Broken example
2005-08-27 11:30:15 drewmccormack [Reply | View]
Just to elaborate on this: the reason the article doesn't include the -hostname and -password options is that when I was writing the article, I unwittingly set a couple of environment variables, and forgot to unset them. The environment variables are:
XGRID_CONTROLLER_PASSWORD and XGRID_CONTROLLER_HOSTNAME. If you set these, you do not need to keep using hte -hostname and -password options.
To set them, type the following commands on the command line, or add them to your shell configuration file:
export XGRID_CONTROLLER_PASSWORD=your_password
export XGRID_CONTROLLER_HOSTNAME=your_hostname
Sorry for the inconvenience. I should have checked my environment more carefully.
Drew McCormack






Tried it last evening and got...
Agents: 19
Available: 43.29 GHz (22 Processors)
Unavailable: 1.42 GHz (1 Processor)
Nice - Now to write a script to put it to work!!