et_engine.tools

Classes

ArgParser([name])

Tool-side argument parser.

Argument(name, type, description, required, ...)

Tool-side argument handling.

Batch(base_url, *args, **kwargs)

An Interface & Client for interacting with an ET Engine Batch.

Filesystem(base_url, *args, **kwargs)

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

Hardware([filesystem_list, cpu, memory])

Interface for defining ET Engine Hardware specs.

Logger(log_file[, level, append])

Utility for tool-side logging.

Tool(base_url, *args, **kwargs)

Client for interacting with a specific tool.

ToolsClient([base_url])

Client for interacting with ET Engine Tools.

class ArgParser(name: str = '')

Bases: object

Tool-side argument parser.

add_argument(name: str, type: type = <class 'str'>, description: str = '', required: bool = False, default: object = None) None

Adds an argument to the parser.

Parameters:
  • name (str) – Name/key of the argument.

  • type (type, optional) – Object type of the argument. Defaults to str.

  • description (str, optional) – Description of the argument. Defaults to “”.

  • required (bool, optional) – Whether the argument is required or not. Defaults to False.

  • default (object, optional) – Default value of the argument. Defaults to None.

class Argument(name: str, type: type = <class 'str'>, description: str = '', required: bool = False, default: object = None)

Bases: object

Tool-side argument handling.

NOTE: This will likely be refactored to another module or repository in the future.

property value: object

Sets the value of this argument.

Raises:

Exception – If the argument is required but not found in the environment variables.

Returns:

The argument value.

Return type:

object

class Hardware(filesystem_list: list[Filesystem] = [], cpu: int = 1, memory: int = 256)

Bases: Hardware

Interface for defining ET Engine Hardware specs.

class Logger(log_file: str, level='info', append=True)

Bases: object

Utility for tool-side logging. The determination of whether to log, where to log, and what logging level to use must be made within the tool.

NOTE: This will likely be refactored to another module or repository in the future.

debug(*args, **kwargs) None

Wrapper around the base logging.debug method.

info(*args, **kwargs) None

Wrapper around the base logging.info() method.

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

Bases: Tool

Client for interacting with a specific tool.

delete() None

Deletes the tool [NOTE: This action cannot be un-done!]

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

Convert a JSON object to an interactive Tool.

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

  • tool_json (dict) – JSON description of the tool.

Returns:

A Tool object.

Return type:

Self

run_batch(fixed_kwargs: dict = {}, variable_kwargs: list[dict] = [], hardware: ~et_engine.tools.Hardware = <et_engine.tools.Hardware object>) Batch

Submits a parallelized batch of jobs.

Parameters:
  • fixed_kwargs (dict, optional) – Key-value arguments to be passed into each job in the batch. Defaults to {}.

  • variable_kwargs (list, optional) – Variable arguments to be passed into separate jobs in the batch. Defaults to [].

  • hardware (Hardware, optional) – The compute hardware to run for each job in the batch. Defaults to default hardware.

Returns:

The batch of jobs submitted to The Engine

Return type:

Batch

status() dict

Fetches the current status of the tool.

Returns:

A JSON-like dictionary describing the tool status.

Return type:

dict

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

Bases: APIClient

Client for interacting with ET Engine Tools.

connect(tool_name: str) Tool

Connect to a specific Tool.

Parameters:

tool_name (str) – Name of the Tool to connect to.

Raises:

Exception – No Tool exists with the specified name.

Returns:

A new Tool client.

Return type:

Tool

create_tool(tool_name: str, tool_description: str) Tool

Create a new ET Engine Tool.

Parameters:
  • tool_name (str) – Unique name of the tool.

  • tool_description (str) – Description of what the tool does.

Returns:

A client for the newly-created Tool.

Return type:

Tool

list_tools() list[Tool]

Lists all the available tools.

Returns:

A list of individual Tool clients.

Return type:

list[Tool]