et_engine.filesystems

Classes

Filesystem(base_url, *args, **kwargs)

An Interface and Client for interacting with an ET Engine Filesystem.

FilesystemsClient([base_url])

Client for interacting with ET Engine Filesystems.

class Filesystem(base_url: str, *args, **kwargs)

Bases: Filesystem

An Interface and Client for interacting with an ET Engine Filesystem.

delete(path: str) None

Delete a file on the remote filesystem.

Parameters:

path (str) – Path to the file to be deleted.

download(remote_file: str, local_file: str, chunk_size: int = 8388608) None

Downloads a copy of a filesystem file to the local machine

Parameters:
  • remote_file (str) – Path to the remote copy of the file inside the filesystem

  • local_file (str) – Path to the destination of the downloaded file

  • chunk_size (int, optional) – Size of each chunk, in bytes. Defaults to clients.MIN_CHUNK_SIZE_BYTES.

static from_json(base_url: str, filesystem_json: dict) Self

Convert a JSON object to an interactive Filesystem.

Parameters:
  • base_url (str) – Base endpoint for requests.

  • filesystem_json (dict) – JSON description of the Filesystem.

Returns:

A Filesystem object.

Return type:

Self

ls(path: str = '') dict[str, list]

List contents of a directory within a filesystem.

Parameters:

path (str, optional) – Path to the directory to perform the ls command. Defaults to ‘’.

Returns:

A dictionary with keys [‘directories’, ‘files’], each of which maps to a list of directories and files within the requested directory, respsectively.

Return type:

dict[str, list]

mkdir(path: str, ignore_exists: bool = False) None

Make a new directory in the remote filesystem.

Parameters:
  • path (str) – Path to the new directory.

  • ignore_exists (bool, optional) – Whether to ignore errors caused by the directory already existing. Defaults to False.

upload(local_file: str, remote_file: str, chunk_size: int = 8388608) None

Uploads a local file to the specified path on The Engine.

Parameters:
  • local_file (str) – A valid path to file on the local filesystem.

  • remote_file (str) – A valid path to the destination of the remote file, starting from the filesystem root.

  • chunk_size (int, optional) – Size of each chunk, in bytes. Defaults to clients.MIN_CHUNK_SIZE_BYTES.

class FilesystemsClient(base_url: str = 'https://api.exploretech.ai/v1')

Bases: APIClient

Client for interacting with ET Engine Filesystems.

connect(filesystem_name: str) Filesystem

Connect the client to a specific Filesystem resource.

Parameters:

filesystem_name (str) – Name of the filesystem to connect to.

Raises:

Exception – A filesystem with the specified name does not exist.

Returns:

A new interactive Filesystem object for the specified filesystem.

Return type:

Filesystem

create_filesystem(filesystem_name: str) Filesystem

Creates a new ET Engine Filesystem resource.

Parameters:

filesystem_name (str) – Unique name of the filesystem to create.

Returns:

A new interactive Filesystem object.

Return type:

Filesystem

list_filesystems() list[Filesystem]

List all the available filesystems.

Returns:

A list of Filesystem clients.

Return type:

list[Filesystem]