NAME

Schedule::Load::Schedule - Functions for choosing a host among many

SYNOPSIS

use Schedule::Load::Schedule;

my $scheduler = Schedule::Load::Schedule->fetch();
print "Best host for a new job: ", $scheduler->best();

DESCRIPTION

This package will allow the most lightly loaded host to be chosen for new jobs across many machines across a entire network.

It is also a superclass of Schedule::Load::Hosts, so any functions that work for that module also work here.

METHODS

best (...)

Returns the hostname of the best host in the network for a single new job. Parameters may be parameters specified in this class, Schedule::Load::Hold, or Schedule::Load::ResourceReq. Those packages must be used individually if multiple resources need to be scheduled simultaneously.

fixed_load (load=>load_value, [pid=>$$], [host=>localhost], [req_pid=>$$, req_hostname=>localhost])

Sets the current process and all children as always having at least the load value specified. This prevents under-counting CPU utilization when a large batch job is running which is just paused in the short term to do disk IO or sleep. Requests to fake reporters (resources not associated with a CPU) may specify req_pid and req_hostname which are the PID and hostname that must continue to exist for the fixed_load to remain in place.

hold_release (hold_key=>key)

Releases the temporary hold placed with the best function.

hosts_of_class (class=>name)

Depreciated, and to be removed in later releases. Use hosts_match instead.

jobs (...)

Returns the maximum number of jobs suggested for the given scheduling parameters. Presumably this will be used to spawn parallel jobs for one given user, such as the make -j command. Jobs() takes the same arguments as best(), in addition to the max_jobs parameter.

release (host=>hostname)

Releases the machine from exclusive use of any user. The user doing the release does not have to be the same user that reserved the host.

reserve (host=>hostname, [comment=>comment])

Reserves the machine for exclusive use of the current user. The host chosen must have the reservable flag set. rschedule hosts will show the host as reserved, along with the provided comment.

schedule (hold=>Schedule::Load::Hold ref, resources=>[], [allow_none=>1])

Schedules the passed list of Schedule::Load::ResourceReq resources, and holds them using the passed hold key. If allow_none is set and the loading is too high, does not schedule any resources. Returns a object reference to use with scheduled_hosts, or undef if no resources available.

scheduled_hosts

Returns a list of Schedule::Load::Host objects that were scheduled using the last schedule() call.

set_stored (host=>hostname, [set_const=>1], [key=>value])

Set a key/value parameter on the persistent storage on the remote server, such as if a class is allowed on that host. With const=>1, don't make it persist, but make it look like the daemon was started with that option; when the daemon restarts the information will be lost.

PARAMETERS

Parameters for the new and fetch calls are shown in Schedule::Load::Hosts.

allow_none

If allow_none is true, if there is less than a free CPU across the entire network, then no cpu will be chosen. This is useful for programs that can dynamically adjust their outstanding job count. (Presumably you would only set allow_none if you already have one job running, or you can get live-locked out of getting anything!)

DISTRIBUTION

The latest version is available from CPAN and from http://www.veripool.org/.

Copyright 1998-2011 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.

AUTHORS

Wilson Snyder <wsnyder@wsnyder.org>

SEE ALSO

Schedule::Load, Schedule::Load::Hosts, rschedule