macdevcenter.com
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

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

Now you can retrieve the job specification, which is the property list you need to submit batch jobs:




drew pbook: xgrid -job specification -id 8
{
    jobSpecification = {
        applicationIdentifier = "com.apple.xgrid.cli"; 
        inputFiles = {}; 
        name = "/usr/bin/cal"; 
        submissionIdentifier = abc; 
        taskSpecifications = {
            0 = {arguments = (3, 2005); 
                 command = "/usr/bin/cal"; }; 
        }; 
    }; 
}

The best approach is to pipe the output of this command to file and edit it, either with your favorite text editor, or with Apple's Property List Editor (in /Developer/Applications/Utilities). The following command will dump the property list to the file batch.plist:


drew pbook: xgrid -job specification -id 8 > batch.plist

Once you have the property list, you can add new tasks to it. Here is an example with three separate tasks:


{
    jobSpecification = {
        applicationIdentifier = "com.apple.xgrid.cli";
        inputFiles = {};
        name = "Sleepy Calendar";
        submissionIdentifier = abc;
        taskSpecifications = {
            0 = {arguments = (3, 2005); command = "/usr/bin/cal";};
            1 = {arguments = (20); command = "/bin/sleep";};
            "hi" = {arguments = ("Hi Mom!"); command = "/bin/echo";};
            };
    };
}

The three tasks are:

  1. The cal command from earlier, which prints a calendar for March 2005.
  2. A sleep command that simply waits 20 seconds before exiting.
  3. An echo command that prints "Hi Mom!" and exits.

Each command is provided in the dictionary corresponding to the key taskSpecifications. Each task has an arbitrary identifier; you can use simple indexes like 0 and 1, or more meaningful keys like the string "hi"; it's up to you. The attributes of each task are given in a dictionary, which include entries for the command itself, and the arguments that should be passed to it.

To run the batch job, you simply use the -job option with the batch keyword.


drew pbook: xgrid -job batch batch.plist
{jobIdentifier = 10; }

Now would be a good time to take a look at the Xgrid Admin tool; you should be able to see the CPU power meter in the Overview tab spring into action, and the new Sleepy Calendar job appear in the table view of the Jobs tab (no relation to everyone's favorite iCEO). A progress bar will tell you when all tasks are complete, which shouldn't take much longer than 20 seconds.

Retrieving the results of a batch job is no different to nonbatch jobs:


drew pbook: xgrid -job results -id 10
     March 2005
 S  M Tu  W Th  F  S
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

Hi Mom!

Results are returned for each task in order, beginning with the output of the cal command, and ending with echo's greeting.

Pages: 1, 2, 3, 4, 5

Next Pagearrow