Products agentidler
Home Products Support Life Site Map Contact Us

The agentidler Library

agentidler is an Objective-C source file that provides a set of functions that tell whether or not your Xgrid agent program should stop using processor power due to a person walking up to the computer. It was written because Xgrid does not currently support forcibly terminating or suspending an agent program when the agent computer becomes unavailable. On the other hand, all the information you need to figure this out exists right at your fingertips on the agent machine. This library reduces all the logic and error checking involved with this idea down to a handful of simple, fast functions.

This code also provides some of the command strings for an Xgrid controller so that you don't have to memorize them yourself. These commands provide functions such as reporting progress to the controller, restarting the task or job, and declaring an agent unusable for the task or job. All you have to do is print the strings to stdout.

This code should compile on any platform, however the majority of the functionality exists only on Mac OS X.

agentidler download (revision 18)

Other attributes:

Some of the functionality in the agentidler library was best achieved using Objective-C code, but I feel that it is important that the agentidler library be implementable from ANSI C, and thus, most of C's derivatives. With this in mind, the library itself is technically Objective C, however all of the public functions use ANSI C syntax - And thus, this library can be used with C, and most of C's derivatives.

Usage

This library provides three primary functions (plus some others, but these are the three most useful):

These ideas correspond with the following functions:

Then, it is just a matter of using these functions. Typically, you would only use one of these. Just stick it in a place in your code where you do a lot of computing, and this library does the rest.

Explanations of exactly what these functions do, and a detailed example of how to use them is included with the agentidler library.

Extra Goodies

Because the agentidler library is designed for use with Xgrid agent programs, it makes some sense to include some other related useful functions.

Other Platforms

Because a cross platform Xgrid agent daemon has been written, I feel that it is important to maintain this library with multi-platform functionality in mind. So far, however, the cross platform functionality of this code is restricted to only compiling on any platform. For example, if you compile this library on BSD or Linux, then the function XGIdlerGetMachineIdleStatus will always report that the machine is idle.

With that said, two of the functions here rely solely on the standard C library, and are completely cross platform because of that: XGIdlerGetElapsedSeconds, and XGIdlerReportProgressToController. And don't forget about the controller command strings. They'll work on any platform, too - they're just preprocessor defines.

BUT - If anyone has any code that would get this library to really run on other platforms, then I would be happy to include it in here!

* To help control spam, Javascript is required to view the email addresses.
Last updated 6/21/2010