NAME

Chirp::Client - Perl Chirp client bindings

SYNOPSIS

The objects and methods provided by this package correspond to the native C API in chirp_reli.h for client creation and control. This module is automatically loaded with Chirp::Client.

use Chirp::Client;
my $client = Chirp::Client('localhost:9094');
print $client->whoami(timeout => 120), "\n";
put $client->put('myfile', destination=>'/some/path/myfile');

METHODS

Chirp::Client

Chirp::Client->new(hostport=>'addr:port', ...);

Creates a new chirp client connected to the server at addr:port.

hostport=> The host:port of the server (default is localhost:9094). =item timeout=> The time to wait for a server response on every request (default is 60). =item authentication=> A list of prefered authentications. E.g., ['tickets', 'unix'] =item debug=> Generate client debug output (default 0).

hostport

Returns the hostport of the chirp server the client is connected.

timeout

Returns the default timeout of the client when waiting for to the server.

identity

Returns a string with identity of the client according to the server. It is the value of a call to whoami just after the client connects to the server.

All the following methods receive the following optional keys:

absolute_stop_time If given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeout If given, maximum number of seconds to wait for a server response.

whoami

Returns a string with identity of the client according to the server.

listacl(path)

Returns a string with the ACL of the given directory. Dies if path cannot be accessed.

path Target directory.

setacl(path)

Modifies the ACL for the given directory.

path Target directory.
subject Target subject.
rights Permissions to be granted.

resetacl(path)

Set the ACL for the given directory to be only for the rights to the calling user.

path Target directory.
rights Permissions to be granted.

ls(path)

Returns a list with stat objects of the files in the path. Dies if path cannot be accessed.

path Target file/directory.

stat(path)

Returns a Chirp::Stat object with information on path. Dies if path cannot be accessed.

path Target file/directory.

chmod(path, mode)

Changes permissions on path.

path Target file/directory. =item mode Desired permissions (e.g., 0755)

put(source, destination => ...)

Copies local file/directory source to the chirp server as file/directory destination. If destination is not given, source name is used. Dies on error.

source A local file or directory.
destination=> File or directory name to use in the server (defaults to source).

get(source, destination => ...)

Copies server file/directory source to the local file/directory destination. If destination is not given, source name is used. Dies on error.

source A server file or directory.
destination=> File or directory name to be used locally (defaults to source).

rm(path)

Removes the given file or directory from the server. Dies on error.

path Target file/directory.

mkdir(path)

Recursively create the directories in path. Dies on error.

path Target directory.
mode=> Unix permissions for the created directory (default 0755).
ignore_exist=> Ignore error if directory exists (default 0)

hash(path, algorithm => ...)

Computes the checksum of path.

path Target file.
algorithm=> One of 'md5' or 'sha1' (default if not given).

Job interface

Chirp job interface. (Needs the JSON module from CPAN).

job_create(job_description)

Creates a chirp job. See http://ccl.cse.nd.edu/software/manuals/chirp.html for details.

my $job_description = {
        executable => "/bin/tar",
        arguments  =>  qw(tar -cf archive.tar a b),
        files      => { task_path => 'a',
                                        serv_path => '/users/magrat/a.txt'
                                        type      => 'INPUT' },
                                  { task_path => 'b',
                                        serv_path => '/users/magrat/b.txt'
                                        type      => 'INPUT' },
                                  { task_path => 'archive.tar',
                                        serv_path => '/users/magrat/archive.tar'
                                        type      => 'OUTPUT' }
};

my $job_id = $client->job_create($job_description);
job_description A hash reference with a job chirp description.

job_commit(job_id, job_id, ...)

Commits (starts running) the jobs identified with the different job ids.

$client->commit($job_id);
job_id,... Job ids of the chirp jobs to be committed.

job_kill(job_id, job_id, ...)

$client->commit($job_id);

Kills the jobs identified with the different job ids.

job_id,... Job ids of the chirp jobs to be killed.

job_reap(job_id, job_id, ...)

Reaps the jobs identified with the different job ids.

job_id,... Job ids of the chirp jobs to be reaped.

job_status(job_id, job_id, ...)

Obtains the current status for each job id. The value returned is an array reference, which contains a hash reference per job_id.

my $jobs_states = $client->job_status($job_a, $job_b);

for my $state ($jobs_states) {
        print 'Job ' . $state->{id} . ' is ' . $state->{status} . "\n";
}
job_id,... Job ids of the chirp jobs to request an status update.

job_wait(waiting_time, job_id=>id)

Waits waiting_time seconds for the job_id to terminate. Return value is the same as job_status. If the call timesout, an empty string is returned. If job_id is missing, <job_wait> waits for any of the user's job.

waiting_time maximum number of seconds to wait for a job to finish. =item job_id id of the job to wait.

1;

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 585:

'=item' outside of any '=over'

Around line 596:

'=item' outside of any '=over'

Around line 605:

'=item' outside of any '=over'

Around line 621:

'=item' outside of any '=over'

Around line 632:

'=item' outside of any '=over'