Package pyGlobus :: Module gramClient :: Class GramClient
[show private | hide private]
[frames | no frames]

Class GramClient


The main interface to the gram client module.

It is mainly a proxy class for the gramClient module. It provides a higher level interface designed to simplify usage. Exceptions are used to indicate all error conditions.
Method Summary
  __init__(self)
Constructs an instance.
  __del__(self)
Destroys an instance.
  cancel_job(self, jobContact)
Cancels a job.
  check_status(self, jobContact)
Checks the status of a current job.
  debug(self)
Enables debugging output.
  ping(self, jobContact)
Pings a gatekeeper.
  refresh_credentials(self, jobContact, cred)
Refresh credentials assosciated with a job.
  register_callback(self, jobContact, stateMask, callbackContact)
Registers a callback.
  register_callback_registration(self, jobContact, jobStateMask, callbackContact, attr, func, userArg)
Non-blocking callback registration.
  register_cancel_job(self, jobContact, attr, callback, arg)
Cancels a job, giving return information to a callback rather than blocking for it.
  register_check_status(self, jobContact, attr, callback, arg)
Nonblocking query of a job's status.
  register_refresh_credentials(self, jobContact, cred, attr, func, userArg)
Non-blocking for of credential refresh.
  register_submit_request(self, resourceManager, description, jobStateMask, callbackContact, attr, func, userArg)
Non-blocking submit a job request to a resource manger.
  remove_callback(self, callbackContact)
Stops the callback.
  set_callback(self, callback, arg)
Sets a callback.
  submit_request(self, resourceManager, description, jobStateMask, callbackContact)
Submits a job request to a resource manger.
  unregister_callback(self, jobContact, callbackContact)
Unregisters a callback.
  version(self)
Returns an int version number for the gram client package.

Method Details

__init__(self)
(Constructor)

Constructs an instance.

This will activate the globus_gram_client_mddule.
Raises:
GramClientException - A GramClientException is thrown if unable to activate the module.

__del__(self)
(Destructor)

Destroys an instance.

It will deactivate the globus_gram_client module when the object is destroyed.

cancel_job(self, jobContact)

Cancels a job.
Parameters:
jobContact - A string containing the contact information for the job to be canceled.
Raises:
GramClientException - A GramClientException if unable to cancel the job.

check_status(self, jobContact)

Checks the status of a current job.
Parameters:
jobContact - A string containing the contact information for the job you would like the status of.
Returns:

An int containing the current job status. This int will be one of the module constants defined above.

Also returns a second int *if* the job status is failure.
Raises:
GramClientException - A GramClientException if unable to get the job status.

debug(self)

Enables debugging output.

ping(self, jobContact)

Pings a gatekeeper.
Parameters:
jobContact - A string containing the contact information

refresh_credentials(self, jobContact, cred)

Refresh credentials assosciated with a job.
Parameters:
jobContact - A string containing the job contact information.
cred - An instance of pyGlobus.security.GSSCred containing the credential ot use to contact the job manager. If GSS_C_NO_CREDENTIAL is used the process's default credential will be used.
Returns:
A job contact.
Raises:
GramClientException - A GramClientException if an error occurs while refreshing creds.

register_callback(self, jobContact, stateMask, callbackContact)

Registers a callback.

Sets the function to receive job state changes for the given job.
Parameters:
jobContact - The job who's changes should be reported to the given callback.
stateMask - Which job state change messages you wish to be notified of. The notification happens through the callback. This is an int that can formed by bitwise or'ing the module constants defined above.
callbackContact - The callback that should be notified.
Returns:
Nothing
Raises:
GramClientException - A GramClientException if unable to register the callback.

register_callback_registration(self, jobContact, jobStateMask, callbackContact, attr, func, userArg)

Non-blocking callback registration.

Sets the function to receive job state changes for the given job.
Parameters:
jobContact - A string containing the job contact information.
jobStateMask - Which job state change messages you wish to be notified of. The notification happens through the callback. This is an int that can formed by bitwise or'ing the module constants defined above.
callbackContact - The callback that should be notified of job state changes.
attr - An instance of GramClientAttr containing the client attributes to be used.
func -

Callback function to be called when callback registration is completed.

The callback function has the following signature: func(userArg, job_contact, job_state, error)

userArg is the argument passed to register_callback_registration job_contact is a string containing the job contact string job_state is an int containing one of the possible job states error is a tuple containing (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object
userArg - A user defined argument to be passed to the callback functions.
Raises:
GramClientException - A GramClientException if unable to register the callback.

register_cancel_job(self, jobContact, attr, callback, arg)

Cancels a job, giving return information to a callback rather than blocking for it.
Parameters:
jobContact - A string containing the contact information for the job to be canceled.
attr - An instance of GramClientAttr.
callback -

Callback function to be called when job submission is completed.

The callback function has the following signature: func(userArg, job_contact, job_state, error)

userArg is the argument passed to register_submit_request job_contact is a string containing the job contact string job_state is an int containing one of the possible job states error is a tuple containing (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object
arg - A user defined argument to be passed to the callback functions.
Raises:
GramClientException - A GramClientException if unable to cancel the job.

register_check_status(self, jobContact, attr, callback, arg)

Nonblocking query of a job's status.

This function queries the status of the job associated with the job contact, returning it's current job status and job failure reason if it has failed.
Parameters:
jobContact - A string containing the contact for the callback that should be queried.
attr - An instance of GramClientAttr.
callback -

Callback function to be called when job submission is completed.

The callback function has the following signature: func(userArg, job_contact, job_state, error) userArg is the argument passed to register_submit_request job_contact is a string containing the job contact string job_state is an int containing one of the possible job states error is a tuple containing (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object
arg - A user defined argument to be passed to the callback functions.
Raises:
GramClientException - A GramClientException if unable to cancel the job.

register_refresh_credentials(self, jobContact, cred, attr, func, userArg)

Non-blocking for of credential refresh.
Parameters:
jobContact - A string containing the job contact information.
cred - An instance of pyGlobus.security.GSSCred containing the credential ot use to contact the job manager. If the GSSCred's credential is GSS_C_NO_CREDENTIAL the process's default credential will be used.
attr - An instance of GramClientAttr containing the client attributes to be used.
func -

callback function to be called when credential refresh is completed.

The callback function has the following signature: func(userArg, job_contact, job_state, error)

userArg is the argument passed to register_refresh_credentials job_contact is a string containing the job contact string job_state is an int containing one of the possible job states error is a tuple containing (error_code, error_description)
userArg - A user defined argument to be passed to the callback functions.
Raises:
GramClientException - A GramClientException if unable to refresh the credential.

register_submit_request(self, resourceManager, description, jobStateMask, callbackContact, attr, func, userArg)

Non-blocking submit a job request to a resource manger.
Parameters:
resourceManager - The resource manager to submit the job to.
description - An RSL string that contains the job description.
jobStateMask - Which job state change message you wish to be notified of. The notification happens through the callback. This is an int that can be formed by bitwise or'ing the module constants defined above.
callbackContact - A string containing the contact for the callback that should be notified of job state changes.
attr - An instance of GramClientAttr.
func -

Callback function to be called when job submission is completed.

The callback function has the following signature: func(userArg, job_contact, job_state, job_error, general_error)

userArg is the argument passed to register_submit_request job_contact is a string containing the job contact string job_state is an int containing one of the possible job states job_error and general error are tuples of (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object
userArg - A user defined argument to be passed to the callback functions.
Raises:
GramClientException - A GramClientException if unable to submit the job request.

remove_callback(self, callbackContact)

Stops the callback.

Stops the callback from listening for job state changes and cleans up any resources.
Parameters:
callbackContact - The string identifier for the callbck to be removed.
Raises:
GramClientException - A GramClientException if unable to remove the callback.

set_callback(self, callback, arg)

Sets a callback.

Sets the function to be notified of job state changes.
Parameters:
callback - The function that should be called when the job state changes. The function has the following prototype: 'function(arg, contact, state, error)' where contact is the job contact, state is one of the module constants defined above, and error and error is a tuple (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object
arg - The argument to be passed to the callback when it is called.
Returns:
A string containing the callback contact is returned. This can be passed to submit_request.
Raises:
GramClientException - A GramClientException if an error occurs while setting the callback.

submit_request(self, resourceManager, description, jobStateMask, callbackContact)

Submits a job request to a resource manger.
Parameters:
resourceManager - The resource manager to submit the job to.
description - An RSL string that contains the job description.
jobStateMask - Which job state change message you wish to be notified of. The notification happens through the callback. This is an int that can be formed by bitwise or'ing the module constants defined above.
callbackContact - A string containing the contact for the callback that should be notified of job state changes.
Returns:
A string containing the job contact used for communicting with the remote job.
Raises:
GramClientException - A GramClientException if unable to submit the job request.

unregister_callback(self, jobContact, callbackContact)

Unregisters a callback.

Stop notifing the callback of job state changes for the given job.
Parameters:
jobContact - A string containing the contact information
callbackContact - The callback that should no longer be notified.
Raises:
GramClientException -

A GramClientException is thrown if unable to unregister the callback.

Returns: An int containing the current job status. This is one of the values defined in the module constants.

version(self)

Returns an int version number for the gram client package.

Generated by Epydoc 2.1 on Tue Apr 4 14:32:55 2006 http://epydoc.sf.net