access package
Submodules
access.client module
- class access.client.AccessClient(access_config, username, password)[source]
Bases:
object
Provides APIs to communicate with access web services. It is created using function
connect()
- Parameters:
access_config (util.AccessConfig) – Access configuration
username (str) – User to use for accessing APIs
password (str) – Password of the user
- clean()[source]
Delete local access temporary directory
- Return type:
str
- Returns:
Local access temporary directory path
- submit_job(application_id, job_inputs, server_name='')[source]
Submit job to application with given inputs
- Parameters:
application_id (str) – Application to which job has to be submitted
job_inputs (dict[str, str]) –
Inputs to job according to application definition. All values should be provided in string format. Example: job_input = {“CORES”:”1”,”JOB_NAME”:”mbdsystemlvlopt”,
”MEMORY_PLACEMENT”:”true”, “PRIMARY_FILE”:”/stage/mbdsystemlvlopt.fem”, “INCLUDE_FILES”:”/stage/dvgrids.fem;/stage/grids.fem”, “SUBMISSION_DIRECTORY”:”/stage/david/generate_data” …….}
server_name (str) – Name of server to which job has to be submitted. If not mentioned job will be submitted to the first server containing application ‘application_id’
- Return type:
- Returns:
Job object representing the job
- class access.client.Job(job_id, server_name)[source]
Bases:
object
This class represents the job and provides functions to perform operations on this job. It is created using method
AccessClient.submit_job()
- Parameters:
job_id (str) – ID of the job
server_name (str) – Name of the server to which job belongs to
- clean()[source]
Delete job’s local temporary directory
- Return type:
str
- Returns:
Path of job’s local temporary directory
- delete(delete_job_output_directory=False)[source]
Remove job completely irrespective of its state(running, queue, finished etc.)
- Parameters:
delete_job_output_directory (bool) – If True, after deleting job it’s output directory will also be deleted
- Return type:
- Returns:
Current job object
- download_file(file_name, dst_dir_path='')[source]
Once job is finished, using this function a file from job output directory can be downloaded
- Parameters:
file_name (str) – Name of the file to be downloaded
dst_dir_path (str) – Path of the directory where file should be downloaded. If not specified it will be downloaded to job’s local temporary directory.
- Return type:
str
- Returns:
Path of the downloaded file
- status()[source]
Get current status of the job
- Job state can be:
B : (Job arrays only) Job array is begun, meaning that at least one subjob has started
D : (Access Desktop only) Job is downloading files from head node to local machine
E : Job is exiting after having run
F : Job is finished. Job might be completed execution, failed during execution, or terminated
H : Job is held. A job is put into a held state by the server or by a user or administrator. A job stays in a held state until it is released by a user or administrator
M : Job was moved to another server
Q : Job is queued, eligible to run or be routed
R : Job is running
S : Job is suspended by scheduler. A job is put into the suspended state when a higher priority job needs the resources
T : Job is in transition to or from a server
U : (Access Desktop only) Job is uploading files from local machine to head node
W : Job is waiting for its requested execution time to be reached, or job is delayed due to stagein failure
X : (Subjobs only) Subjob is finished(expired.)
- Return type:
str
- Returns:
Job’s current status
- access.client.connect(url, username, http_connection_timeout=10)[source]
Create access client connection using provided information
- Parameters:
url (str) – Access web server URL
username (str) – User to use for accessing APIs
http_connection_timeout (int) – Maximum time(in seconds) to wait for establishing HTTP connection to Access web REST APIs
- Return type:
- Returns:
Access client object