et_engine.tools¶
Classes
|
Tool-side argument parser. |
|
Tool-side argument handling. |
|
An Interface & Client for interacting with an ET Engine Batch. |
|
An Interface and Client for interacting with an ET Engine Filesystem. |
|
Interface for defining ET Engine Hardware specs. |
|
Utility for tool-side logging. |
|
Client for interacting with a specific tool. |
|
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:
- 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: