cctools
Public Member Functions
chirp.Client Class Reference
Inheritance diagram for chirp.Client:

Public Member Functions

def __init__
 Create a new chirp client. More...
 
def whoami
 Returns a string with identity of the client according to the server. More...
 
def listacl
 Returns a string with the ACL of the given directory. More...
 
def setacl
 Returns a string with the ACL of the given directory. More...
 
def resetacl
 Set the ACL for the given directory to be only for the rights to the calling user. More...
 
def ls
 Returns a list with the names of the files in the path. More...
 
def stat
 Returns a Chirp.Stat object with information on path. More...
 
def chmod
 Changes permissions on path. More...
 
def put
 Copies local file/directory source to the chirp server as file/directory destination. More...
 
def get
 Copies server file/directory source to the local file/directory destination. More...
 
def rm
 Removes the given file or directory from the server. More...
 
def mkdir
 Recursively create the directories in path. More...
 
def hash
 Computes the checksum of path. More...
 
def job_create
 Creates a chirp job. More...
 
def job_kill
 Kills the jobs identified with the different job ids. More...
 
def job_commit
 Commits (starts running) the jobs identified with the different job ids. More...
 
def job_reap
 Reaps the jobs identified with the different job ids. More...
 
def job_status
 Obtains the current status for each job id. More...
 
def job_wait
 Waits waiting_time seconds for the job_id to terminate. More...
 

Constructor & Destructor Documentation

def chirp.Client.__init__ (   self,
  hostport,
  timeout = 60,
  authentication = None,
  tickets = None,
  debug = False 
)

Create a new chirp client.

Parameters
selfReference to the current task object.
hostportThe host:port of the server.
timeoutThe time to wait for a server response on every request.
authenticationA list of prefered authentications. E.g., ['tickets', 'unix']
ticketsA list of ticket filenames.
debugGenerate client debug output.

References chirp.Client.__set_tickets(), auth_register_all(), auth_register_byname(), chirp_reli_disconnect(), chirp.Client.hostport, chirp.Client.identity, chirp.Client.timeout, and chirp.Client.whoami().

Member Function Documentation

def chirp.Client.whoami (   self,
  absolute_stop_time = None,
  timeout = None 
)

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

Parameters
selfReference to the current task object.
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

Referenced by chirp.Client.__init__().

def chirp.Client.listacl (   self,
  path = '/',
  absolute_stop_time = None,
  timeout = None 
)

Returns a string with the ACL of the given directory.

Throws an IOError on error (no such directory).

Parameters
selfReference to the current task object.
pathTarget directory.
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.setacl (   self,
  path,
  subject,
  rights,
  absolute_stop_time = None,
  timeout = None 
)

Returns a string with the ACL of the given directory.

Throws a GeneralError on error.

Parameters
selfReference to the current task object.
pathTarget directory.
subjectTarget subject.
rightsPermissions to be granted.
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), chirp_reli_setacl(), and chirp.Client.hostport.

def chirp.Client.resetacl (   self,
  path,
  rights,
  absolute_stop_time = None,
  timeout = None 
)

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

Throws a GeneralError on error.

Parameters
selfReference to the current task object.
pathTarget directory.
rightsPermissions to be granted.
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.ls (   self,
  path,
  absolute_stop_time = None,
  timeout = None 
)

Returns a list with the names of the files in the path.

Throws an IOError on error (no such directory).

Parameters
selfReference to the current task object.
pathTarget file/directory.
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), chirp_reli_opendir(), chirp_reli_readdir(), and chirp.Client.hostport.

def chirp.Client.stat (   self,
  path,
  absolute_stop_time = None,
  timeout = None 
)

Returns a Chirp.Stat object with information on path.

Throws an IOError on error (e.g., no such path or insufficient permissions).

Parameters
selfReference to the current task object.
pathTarget file/directory.
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.chmod (   self,
  path,
  mode,
  absolute_stop_time = None,
  timeout = None 
)

Changes permissions on path.

Throws a GeneralFailure on error (e.g., no such path or insufficient permissions).

Parameters
selfReference to the current task object.
pathTarget file/directory.
modeDesired permissions (e.g., 0755)
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), chirp_reli_chmod(), and chirp.Client.hostport.

def chirp.Client.put (   self,
  source,
  destination = None,
  absolute_stop_time = None,
  timeout = None 
)

Copies local file/directory source to the chirp server as file/directory destination.

If destination is not given, source name is used. Raises Chirp.TransferFailure on error.

Parameters
selfReference to the current task object.
sourceA local file or directory.
destinationFile or directory name to use in the server (defaults to source).
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), chirp_recursive_put(), and chirp.Client.hostport.

def chirp.Client.get (   self,
  source,
  destination = None,
  absolute_stop_time = None,
  timeout = None 
)

Copies server file/directory source to the local file/directory destination.

If destination is not given, source name is used. Raises Chirp.TransferFailure on error.

Parameters
selfReference to the current task object.
sourceA server file or directory.
destinationFile or directory name to be used locally (defaults to source).
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), chirp_recursive_get(), and chirp.Client.hostport.

def chirp.Client.rm (   self,
  path,
  absolute_stop_time = None,
  timeout = None 
)

Removes the given file or directory from the server.

Raises OSError on error.

Parameters
selfReference to the current task object.
pathTarget file/directory.
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), chirp_reli_rmall(), and chirp.Client.hostport.

def chirp.Client.mkdir (   self,
  path,
  mode = 493,
  absolute_stop_time = None,
  timeout = None 
)

Recursively create the directories in path.

Raises OSError on error.

Parameters
selfReference to the current task object.
pathTarget file/directory.
modeUnix permissions for the created directory.
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), chirp_reli_mkdir_recursive(), and chirp.Client.hostport.

def chirp.Client.hash (   self,
  path,
  algorithm = 'sha1',
  absolute_stop_time = None,
  timeout = None 
)

Computes the checksum of path.

Raises IOError on error.

Parameters
selfReference to the current task object.
pathTarget file.
algorithmOne of 'md5' or 'sha1' (default).
absolute_stop_timeIf given, maximum number of seconds since epoch to wait for a server response. (Overrides any timeout.)
timeoutIf given, maximum number of seconds to wait for a server response.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.job_create (   self,
  job_description 
)

Creates a chirp job.

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

Parameters
job_descriptionA dictionary with a job chirp description.
1 job_description = {
2  'executable': "/bin/tar",
3  'arguments': [ 'tar', '-cf', 'archive.tar', 'a', 'b' ],
4  'files': { 'task_path': 'a',
5  'serv_path': '/users/magrat/a.txt'
6  'type': 'INPUT' },
7  { 'task_path': 'b',
8  'serv_path': '/users/magrat/b.txt'
9  'type': 'INPUT' },
10  { 'task_path': 'archive.tar',
11  'serv_path': '/users/magrat/archive.tar'
12  'type': 'OUTPUT' }
13 }
14 job_id = client.job_create(job_description);

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.job_kill (   self,
  job_ids 
)

Kills the jobs identified with the different job ids.

Parameters
job_idsJob ids of the chirp jobs to be killed.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.job_commit (   self,
  job_ids 
)

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

Parameters
job_idsJob ids of the chirp jobs to be committed.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.job_reap (   self,
  job_ids 
)

Reaps the jobs identified with the different job ids.

Parameters
job_idsJob ids of the chirp jobs to be reaped.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.job_status (   self,
  job_ids 
)

Obtains the current status for each job id.

The value returned is a list which contains a dictionary reference per job id.

Parameters
job_idsJob ids of the chirp jobs to be reaped.

References chirp.Client.__stoptime(), and chirp.Client.hostport.

def chirp.Client.job_wait (   self,
  waiting_time,
  job_id = 0 
)

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.

Parameters
waiting_timemaximum number of seconds to wait for a job to finish.
job_idid of the job to wait.

References chirp.Client.__stoptime(), and chirp.Client.hostport.


The documentation for this class was generated from the following file: