Chirp::Client - Perl Chirp client bindings
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');
Chirp::Client->new(hostport=>'addr:port', ...);
Creates a new chirp client connected to the server at addr:port.
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:
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.
setacl(path)
Modifies the ACL for the given directory.
resetacl(path)
Set the ACL for the given directory to be only for the rights to the calling user.
ls(path)
Returns a list with stat objects of the files in the path. Dies if path cannot be accessed.
stat(path)
Returns a Chirp::Stat object with information on path. Dies if path cannot be accessed.
chmod(path, mode)
Changes permissions on path.
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.
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.
rm(path)
Removes the given file or directory from the server. Dies on error.
mkdir(path)
Recursively create the directories in path. Dies on error.
hash(path, algorithm => ...)
Computes the checksum of path.
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_commit(job_id, job_id, ...)
Commits (starts running) the jobs identified with the different job ids.
$client->commit($job_id);
job_kill(job_id, job_id, ...)
$client->commit($job_id);
Kills the jobs identified with the different job ids.
job_reap(job_id, job_id, ...)
Reaps the jobs identified with the different job ids.
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_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.
1;
Hey! The above document had some coding errors, which are explained below:
'=item' outside of any '=over'
'=item' outside of any '=over'
'=item' outside of any '=over'
'=item' outside of any '=over'
'=item' outside of any '=over'