Runner API
api_create_runner(name, endpoints, description='', progress_callback_func=None)
Creates a new runner.
This function takes the name, endpoints, and an optional progress callback function to create a new Runner instance. The id of the runner is generated from the name of the runner using the slugify function, so it does not need to be provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the runner. |
required |
endpoints |
list[str]
|
A list of endpoint identifiers for the runner. |
required |
description |
str
|
A brief description of the runner. Defaults to an empty string. |
''
|
progress_callback_func |
Callable | None
|
An optional callback function for progress updates. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Runner |
Runner
|
A new Runner object. |
Source code in moonshot/src/api/api_runner.py
api_delete_runner(runner_id)
Deletes a runner by its identifier.
This function takes a runner ID as input and calls the delete method from the Runner class to remove the specified runner from storage.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
runner_id |
str
|
The unique identifier of the runner to be deleted. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the runner was successfully deleted. |
Raises:
Type | Description |
---|---|
Exception
|
If the deletion process encounters an error. |
Source code in moonshot/src/api/api_runner.py
api_get_all_runner()
Retrieves all available runners.
This function calls the get_available_items method to retrieve all available runners. It then converts each runner into a dictionary using the to_dict method and returns a list of these dictionaries.
Returns:
Type | Description |
---|---|
list[dict]
|
list[dict]: A list of dictionaries, each representing a runner. |
Source code in moonshot/src/api/api_runner.py
api_get_all_runner_name()
Retrieves all available runner names.
This function calls the get_available_items method to retrieve all available runners. It then extracts the names of each runner and returns a list of these names.
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: A list of runner names. |
Source code in moonshot/src/api/api_runner.py
api_load_runner(runner_id, progress_callback_func=None)
Loads a runner based on the provided runner ID.
This function retrieves the runner using the provided runner ID and then loads it. It utilizes the Runner's load method to fetch and return the runner.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
runner_id |
str
|
The ID of the runner to be loaded. |
required |
progress_callback_func |
Callable | None
|
The progress callback function to be used by the runner. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Runner |
Runner
|
An initialized Runner object. |
Source code in moonshot/src/api/api_runner.py
api_read_runner(runner_id)
Reads a runner and returns its information.
This function takes a runner ID as input, reads the corresponding runner, and returns a dictionary containing the runner's information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
runner_id |
str
|
The ID of the runner. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary containing the runner's information. |