et_engine.tools
Functions
|
Searches for a tool with the specified name and returns a Tool object if found. |
|
Creates a new Tool |
Classes
|
Tool-side argument parser |
|
Tool-side argument handling |
|
|
|
Utility for tool-side logging. |
|
Class for interacting with a Tool |
Exceptions
- et_engine.tools.connect(tool_name)[source]
Searches for a tool with the specified name and returns a Tool object if found.
- Parameters:
name (string) – Name of the tool to connect to
- et_engine.tools.create(name, description)[source]
Creates a new Tool
- Parameters:
name (string) – Name of the tool
description (string) – Plain text description of the tool
- Returns:
A Tool object connected to the newly-created tool
- Return type:
- class et_engine.tools.Tool(tool_id)[source]
Class for interacting with a Tool
- id
unique ID of the tool
- url
API endpoint for this tool
- Type:
string
- __init__(tool_id) None [source]
Creates a new tool object from an existing tool ID
- Parameters:
tool_id (string) – id associated with the tool of interest
client (Client) – base authenticated client containing the active session
- run_batch(fixed_kwargs={}, variable_kwargs=[], hardware=None)[source]
- Parameters:
fixed_kwargs (dict) – key-value arguments to be passed into each job in the batch
variable_kwargs ([dict]) – variable arguments to be passed into separate jobs in the batch
hardware (Hardware) – the compute hardware to run for each job in the batch
- Return type:
a jobs.Batch object
- push(tar_gz_file, chunk_size=8388608, connections=100, wait=False, sleep_time=60)[source]
Update the tool code
Before pushing the tool, you must build, save, and gzip a docker image on your computer. To do this, run the following commands.
` docker build --tag my_tool /path/to/docker/folder docker save my_tool | gzip > my_tool.tar.gz `
Then, pass the path to /path/to/my_tool.tar.gz to this function. The image will be uploaded, processed, and made available for use.
- Parameters:
tar_gz_file (string) – Path to the .tar.gz file containing the image
chunk_zie (int) – Size of the file chunks to be uploaded in bytes, default = 8192 (8MB) (optional)
- class et_engine.tools.Logger(log_file, level='info', append=True)[source]
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.
- __init__(log_file, level='info', append=True)[source]
- Parameters:
log_file (str) – File name for logging. (If a file name with path is provided, remember that this is on whatever virtual file system may be set up and mounted with the docker container running the tool. Also, note that certain tools are already set up to write these log files to specific places in the virtual file system.)
level (str, optional) – Specified logging level. May be ‘debug’, ‘info’, ‘warning’, ‘error’, or ‘critical’. Default ‘info’. If level is not specified as one of these, then defaults to ‘info’.
append (boolean, optional) – Controls behavior if log_file already exists. If True (default), appends logging information to existing file. If False, overwrites existing file.