|
cctools
|
Public Member Functions | |
| def | __init__ (self, hostport, timeout=60, authentication=None, tickets=None, debug=False) |
| Create a new chirp client. More... | |
| def | whoami (self, absolute_stop_time=None, timeout=None) |
| Returns a string with identity of the client according to the server. More... | |
| def | listacl (self, path='/', absolute_stop_time=None, timeout=None) |
| Returns a string with the ACL of the given directory. More... | |
| def | setacl (self, path, subject, rights, absolute_stop_time=None, timeout=None) |
| Returns a string with the ACL of the given directory. More... | |
| def | 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. More... | |
| def | ls (self, path, absolute_stop_time=None, timeout=None) |
| Returns a list with the names of the files in the path. More... | |
| def | stat (self, path, absolute_stop_time=None, timeout=None) |
| Returns a chirp.Stat object with information on path. More... | |
| def | chmod (self, path, mode, absolute_stop_time=None, timeout=None) |
| Changes permissions on path. More... | |
| def | put (self, source, destination=None, absolute_stop_time=None, timeout=None) |
| Copies local file/directory source to the chirp server as file/directory destination. More... | |
| def | get (self, source, destination=None, absolute_stop_time=None, timeout=None) |
| Copies server file/directory source to the local file/directory destination. More... | |
| def | rm (self, path, absolute_stop_time=None, timeout=None) |
| Removes the given file or directory from the server. More... | |
| def | mkdir (self, path, mode=493, absolute_stop_time=None, timeout=None) |
| Recursively create the directories in path. More... | |
| def | hash (self, path, algorithm='sha1', absolute_stop_time=None, timeout=None) |
| Computes the checksum of path. More... | |
| def | job_create (self, job_description) |
| Creates a chirp job. More... | |
| def | job_kill (self, *job_ids) |
| Kills the jobs identified with the different job ids. More... | |
| def | job_commit (self, *job_ids) |
| Commits (starts running) the jobs identified with the different job ids. More... | |
| def | job_reap (self, *job_ids) |
| Reaps the jobs identified with the different job ids. More... | |
| def | job_status (self, *job_ids) |
| Obtains the current status for each job id. More... | |
| def | job_wait (self, waiting_time, job_id=0) |
| Waits waiting_time seconds for the job_id to terminate. More... | |
Python Client object.
This class is used to create a chirp client
| def ndcctools.chirp.Client.__init__ | ( | self, | |
| hostport, | |||
timeout = 60, |
|||
authentication = None, |
|||
tickets = None, |
|||
debug = False |
|||
| ) |
Create a new chirp client.
| self | Reference to the current task object. |
| hostport | The host:port of the server. |
| timeout | The time to wait for a server response on every request. |
| authentication | A list of prefered authentications. E.g., ['tickets', 'unix'] |
| tickets | A list of ticket filenames. |
| debug | Generate client debug output. |
| def ndcctools.chirp.Client.whoami | ( | self, | |
absolute_stop_time = None, |
|||
timeout = None |
|||
| ) |
Returns a string with identity of the client according to the server.
| self | Reference to the current task object. |
| 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. |
| def ndcctools.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).
| self | Reference to the current task object. |
| path | Target directory. |
| 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. |
| def ndcctools.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.
| self | Reference to the current task object. |
| path | Target directory. |
| subject | Target subject. |
| rights | Permissions to be granted. |
| 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. |
| def ndcctools.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.
| self | Reference to the current task object. |
| path | Target directory. |
| rights | Permissions to be granted. |
| 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. |
| def ndcctools.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).
| self | Reference to the current task object. |
| path | Target file/directory. |
| 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. |
| def ndcctools.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).
| self | Reference to the current task object. |
| path | Target file/directory. |
| 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. |
| def ndcctools.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).
| self | Reference to the current task object. |
| path | Target file/directory. |
| mode | Desired permissions (e.g., 0755) |
| 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. |
| def ndcctools.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.
| self | Reference to the current task object. |
| source | A local file or directory. |
| destination | File or directory name to use in the server (defaults to source). |
| 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. |
| def ndcctools.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.
| self | Reference to the current task object. |
| source | A server file or directory. |
| destination | File or directory name to be used locally (defaults to source). |
| 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. |
| def ndcctools.chirp.Client.rm | ( | self, | |
| path, | |||
absolute_stop_time = None, |
|||
timeout = None |
|||
| ) |
Removes the given file or directory from the server.
Raises OSError on error.
| self | Reference to the current task object. |
| path | Target file/directory. |
| 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. |
| def ndcctools.chirp.Client.mkdir | ( | self, | |
| path, | |||
mode = 493, |
|||
absolute_stop_time = None, |
|||
timeout = None |
|||
| ) |
Recursively create the directories in path.
Raises OSError on error.
| self | Reference to the current task object. |
| path | Target file/directory. |
| mode | Unix permissions for the created directory. |
| 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. |
| def ndcctools.chirp.Client.hash | ( | self, | |
| path, | |||
algorithm = 'sha1', |
|||
absolute_stop_time = None, |
|||
timeout = None |
|||
| ) |
Computes the checksum of path.
Raises IOError on error.
| self | Reference to the current task object. |
| path | Target file. |
| algorithm | One of 'md5' or 'sha1' (default). |
| 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. |
| def ndcctools.chirp.Client.job_create | ( | self, | |
| job_description | |||
| ) |
Creates a chirp job.
See http://ccl.cse.nd.edu/software/manuals/chirp.html for details.
| job_description | A dictionary with a job chirp description. |
| def ndcctools.chirp.Client.job_kill | ( | self, | |
| * | job_ids | ||
| ) |
Kills the jobs identified with the different job ids.
| job_ids | Job ids of the chirp jobs to be killed. |
| def ndcctools.chirp.Client.job_commit | ( | self, | |
| * | job_ids | ||
| ) |
Commits (starts running) the jobs identified with the different job ids.
| job_ids | Job ids of the chirp jobs to be committed. |
| def ndcctools.chirp.Client.job_reap | ( | self, | |
| * | job_ids | ||
| ) |
Reaps the jobs identified with the different job ids.
| job_ids | Job ids of the chirp jobs to be reaped. |
| def ndcctools.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.
| job_ids | Job ids of the chirp jobs to be reaped. |
| def ndcctools.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.
| waiting_time | maximum number of seconds to wait for a job to finish. |
| job_id | id of the job to wait. |