client#
PyHPS Data Transfer is a Python client for Ansys HPC Platform Services (HPS) data transfer.
Submodules#
Attributes#
Exceptions#
Provides server-side related errors. |
|
Provides client-side related errors. |
|
Provides the base class for all HPS-related errors. |
Classes#
Wrapper for the Data Transfer Worker REST API, offering an async interface. |
|
Class for Data transfer API. |
|
An async interface to the Python client to the HPS data transfer APIs. |
|
Provide the Python client to the HPS data transfer APIs. |
Package Contents#
- client.__version__#
- class client.AsyncDataTransferApi(client: client.client.AsyncClient)#
Wrapper for the Data Transfer Worker REST API, offering an async interface.
- dump_mode = 'json'#
- client#
- async status(wait=False, sleep=5, jitter=True, timeout: float | None = 20.0)#
Async interface to get the status of the worker.
- async storages()#
Async interface to get the list of storage configurations.
- async copy(operations: List[client.models.msg.SrcDst])#
Async interface to copy a list of SrcDst objects.
- async exists(operations: List[client.models.msg.StoragePath])#
Async interface to check if a list of StoragePath objects exist.
- async list(operations: List[client.models.msg.StoragePath])#
Async interface to list a list of StoragePath objects.
- async mkdir(operations: List[client.models.msg.StoragePath])#
Async interface to create a list of directories on remote backend.
- async move(operations: List[client.models.msg.SrcDst])#
Async interface to move a list of SrcDst objects in the remote backend.
- async remove(operations: List[client.models.msg.StoragePath])#
Async interface to remove files in the remote backend.
- async rmdir(operations: List[client.models.msg.StoragePath])#
Async interface to remove directories in the remote backend.
- async _exec_async_operation_req(storage_operation: str, operations: List[client.models.msg.StoragePath] | List[client.models.msg.SrcDst])#
- async check_permissions(permissions: List[client.models.permissions.RoleAssignment])#
Async interface to check permissions of a list of RoleAssignment objects.
- async get_permissions(permissions: List[client.models.permissions.RoleQuery])#
Async interface to get permissions of a list of RoleQuery objects.
- async remove_permissions(permissions: List[client.models.permissions.RoleAssignment])#
Async interface to remove permissions of a list of RoleAssignment objects.
- async set_permissions(permissions: List[client.models.permissions.RoleAssignment])#
Async interface to set permissions of a list of RoleAssignment objects.
- async get_metadata(paths: List[str | client.models.msg.StoragePath])#
Async interface to get metadata of a list of StoragePath objects.
- async set_metadata(asgs: Dict[str | client.models.msg.StoragePath, client.models.metadata.DataAssignment])#
Async interface to set metadata of a list of DataAssignment objects.
- class client.DataTransferApi(client: client.client.Client)#
Class for Data transfer API.
- Parameters:
- client: Client
Client object.
- dump_mode = 'json'#
- client#
- storages()#
Get types of storages available on the storage backend.
- copy(operations: List[client.models.msg.SrcDst])#
Get API response for copying a list of files.
- Parameters:
- operations: List[SrcDst]
- exists(operations: List[client.models.msg.StoragePath])#
Check if a path exists.
- Parameters:
- operations: List[StoragePath]
- list(operations: List[client.models.msg.StoragePath])#
List files in a path.
- Parameters:
- operations: List[StoragePath]
- mkdir(operations: List[client.models.msg.StoragePath])#
Create a dir.
- Parameters:
- operations: List[StoragePath]
- move(operations: List[client.models.msg.SrcDst])#
Move a file on the backend storage.
- Parameters:
- operations: List[SrcDst]
- remove(operations: List[client.models.msg.StoragePath])#
Delete a file.
- Parameters:
- operations: List[StoragePath]
- rmdir(operations: List[client.models.msg.StoragePath])#
Delete a dir.
- Parameters:
- operations: List[StoragePath]
- _exec_operation_req(storage_operation: str, operations: List[client.models.msg.StoragePath] | List[client.models.msg.SrcDst])#
- check_permissions(permissions: List[client.models.permissions.RoleAssignment])#
Checks permissions of a path (including parent directory) using a list of RoleAssignment objects.
- Parameters:
- permissions: List[RoleAssignment]
- get_permissions(permissions: List[client.models.permissions.RoleQuery])#
Return permissions of a file from a list of RoleQuery objects.
- Parameters:
- permissions: List[RoleQuery]
- remove_permissions(permissions: List[client.models.permissions.RoleAssignment])#
Remove permissions using a list of RoleAssignment objects.
- Parameters:
- permissions: List[RoleAssignment]
- set_permissions(permissions: List[client.models.permissions.RoleAssignment])#
Set permissions using a list of RoleAssignment objects.
- Parameters:
- permissions: List[RoleAssignment]
- get_metadata(paths: List[str | client.models.msg.StoragePath])#
Get metadata of a path on backend storage.
- Parameters:
- paths: List[str | StoragePath]
- set_metadata(asgs: Dict[str | client.models.msg.StoragePath, client.models.metadata.DataAssignment])#
Setting metadata for a path on backend storage.
- Parameters:
- asgs: Dict[str | StoragePath, DataAssignment]
List of paths with key of type string or StoragePath and value of DataAssignment
- wait_for(operation_ids: List[str | client.models.ops.Operation | client.models.msg.OpIdResponse], timeout: float | None = None, interval: float = 0.1, cap: float = 2.0, raise_on_error: bool = False)#
Wait for operations to complete.
- class client.AsyncClient(*args, **kwargs)#
Bases:
ClientBase
An async interface to the Python client to the HPS data transfer APIs.
- async start()#
Start async binary worker.
- async stop(wait=5.0)#
Stop async binary worker.
- _update_token()#
- async _monitor()#
- class client.Client(*args, **kwargs)#
Bases:
ClientBase
Provide the Python client to the HPS data transfer APIs. This class uses the provided credentials to create and store an authorized
requests.Session
object.- _monitor_thread = None#
- __getstate__()#
- __setstate__(state)#
- start()#
Start client session using binary config credentials.
- stop(wait=5.0)#
Stop client session.
- _update_token()#
- _monitor()#
- exception client.HPSError(*args, **kwargs)#
Bases:
requests.exceptions.RequestException
Provides the base class for all HPS-related errors.
This class derives from the
requests.exceptions.RequestException
base class.- Example:
>>> from ansys.hps.client import HPSError >>> from ansys.hps.client.jms import Client >>> try: >>> client = Client(url="https://127.0.0.1:8443/hps/", username="repuser", password="wrong_psw") >>> except HPSError as e: >>> print(e) 401 Client Error: invalid_grant for: POST https://127.0.0.1:8443/hps/auth... Invalid user credentials
- reason#
- description#
- give_up#