Home | Trees | Index | Help |
---|
Package pyGlobus :: Module gassCache :: Class GassCache |
|
Provides an interface to the gass cache module.
Allows the manipulation of local cache files. Each cache entry can be locked during addition and deletion, to allow for atomic handling of the cache file contents.
Each cache entry also has an associated timestamp. This timestamp is independent of the local cache file's modification time. Rather, the cache entry timestamp is maintained by the user. It can, for example, be used to keep track of the timestamp of a remote file that is associate with a cache entry.
Note: All timestamps are as seconds since the epoch. (01 Jan 1970, 00:00 GMT)Method Summary | |
---|---|
Constructs an instance. | |
Destroy an instance. | |
Add a URL to the cache. | |
Set the timestamp in the cache entry for the URL, and then unlock the cache entry. | |
Gets a bunch of directories. | |
Query if an item is in the cache This call will block only if wait_for_lock is GLOBUS_TRUE | |
Remove the given tag from the cache table. | |
Close the given cache. | |
Delete a tag entry from the cache. | |
Lock the cache entry prior to deleting it. | |
Mangles the given tag into a chunk suitable for using as a file / path name. | |
Mangles the given URL into a chunk suitable for using as a file / path name. | |
Open the given cache. |
Method Details |
---|
__init__(self)
|
__del__(self)
|
add(self, url, tag=None, create=1)Add a URL to the cache. If the URL is already in the cache but is locked, then then this call will block until the cache entry is unlocked, then will proceed with the subsequent operations. If the URL is already in the cache and unlocked, then add the tag to the cache entry's tag list, return the local cache filename, return the entry's current timestamp in *timestamp, lock the cache entry, and return GLOBUS_GASS_CACHE_ADD_EXISTS. If the URL is not in the cache, and create is true, then create a new unique empty local cache file, add it to the cache with the specified tag, return the filename in *local_filename, return *timestamp set to GLOBUS_GASS_TIMESTAMP_UNKNOWN, lock the cache entry, and return GLOBUS_GASS_CACHE_ADD_NEW. If the URL is not in the cache, and create is false, then do not add it to the cache, and return GLOBUS_GASS_CACHE_URL_NOT_FOUND. If this function returns GLOBUS_GASS_CACHE_ADD_EXISTS or GLOBUS_GASS_CACHE_ADD_NEW, then globus_gass_cache_add_done() or globus_gass_cache_delete() must be subsequently called to unlock the cache entry. Subsequent calls to globus_gass_cache_add() and globus_gass_cache_delete_start() on the same cache and url, made either from this process or another, will block until the cache entry is unlocked. If tag == None, then a tag with the value null will be added to the cache entry's tag list. The same tag can be used multiple times, in which case this tag will be added to the entry's tag list multiple times. Note: It is recommended that programs started via GRAM pass a tag value of getenv(GRAM_JOB_CONTACT), since upon completion of a job GRAM will automatically cleanup entries with this tag.
|
add_done(self, url, tag, timestamp)Set the timestamp in the cache entry for the URL, and then unlock the cache entry. globus_gass_cache_add_done() MUST be called after globus_gass_cache_add(), to set the timestamp in the cache entry for the URL, and then unlock the cache entry. (The only case it does not need to be called is if globus_gass_cache_add() has returned GLOBUS_GASS_CACHE_URL_NOT_FOUND, of course.
|
cache_get_dirs(self, url, tag)Gets a bunch of directories. This is exported for use in the globus_gass_cache program.
|
cache_query(self, url, tag, wait_for_lock, timestamp, filename)Query if an item is in the cache This call will block only if wait_for_lock is GLOBUS_TRUE
|
cleanup_tag(self, url, tag)Remove the given tag from the cache table. Remove all instances of the tag from the cache entry's tag list. If there are no more tags in the tag list, then remove this cache entry and delete the associated local cache file. If the cache entry is locked with the same tag as is passed to this function, then the entry is unlocked after removing the tags. Otherwise, the cache entry's lock is left untouched. Note: The GRAM job manager will automatically call this function with a tag of getenv(GRAM_JOB_CONTACT) upon completion of a job.
|
close(self)Close the given cache.
|
delete(self, url, tag, timestamp, isLocked)Delete a tag entry from the cache. Remove one instance of the tag from the cache entry's tag list. If there are no more tags in the tag list, then remove this cache entry and delete the associated local cache file. Otherwise, update the timestamp to the passed value. If is_locked==GLOBUS_TRUE, then this cache entry was locked during a previous call to add() or globus_gass_cache_delete_start(). Otherwise, the entry will be locked at the start of this operation. This call will leave the cache entry unlocked.
|
delete_start(self, url, tag)Lock the cache entry prior to deleting it. Lock the cache entry for the URL, and return the cache entry's current timestamp in *timestamp.
|
mangle_tag(self, tag)Mangles the given tag into a chunk suitable for using as a file / path name.
|
mangle_url(self, url)Mangles the given URL into a chunk suitable for using as a file / path name.
|
open(self, cache_dir=None)Open the given cache. Opens the cache. If cache_dir is None, then use the value contained in the GLOBUS_GASS_CACHE_DEFAULT environment variable if it is defined, otherwise use ~/.gass_cache. The cache_dir must be a directory. If it is a file, this call will fail with an exception. If the specified directory does not exist, then this call will create the directory. In order to insure thread safety, this function must be called in each of the thread which will use globus_gass_cache functions. For each call to globus_gass-cache_open(), the function globus_gass_cache_close() should be called when the code does not need to use globus_gass_cache functions anymore. Note: It is recommended that proglobus_grams started via GLOBUS_GRAM pass a tag value of getenv("GLOBUS_GRAM_JOB_CONTACT"), since upon completion of a job GLOBUS_GRAM will automatically cleanup entries with this tag.
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Tue Apr 4 14:32:52 2006 | http://epydoc.sf.net |