create_engine()#
relationalai.api
#create_engine(name STRING, size STRING, engine_config OBJECT, headers OBJECT)
A procedure that creates a new RelationalAI (RAI) engine of the specified size.
Requires the eng_admin
application role.
Parameters#
Name | Type | Description |
---|---|---|
name | STRING | The name of the new engine (case-sensitive). |
size | STRING | The size of the new engine. This is the same as the host compute pool’s instance family. Must be one of:
|
engine_config | OBJECT or NULL | Specifies the configuration for the new engine. Pass NULL to use the default configuration. See Engine Configuration Object for more information. |
headers | OBJECT or NULL | Specifies HTTP headers to include in the request. Pass NULL to use the default headers. |
Engine Configuration Object#
The engine_config
object is a JSON object that specifies the configuration for the new engine.
The object can contain the following keys:
Key | Type | Description |
---|---|---|
auto_suspend_mins | INT | The number of minutes of inactivity before the engine is automatically suspended. Use 0 to never suspend the engine. (Default: 60 ) |
await_storage_vacuum | BOOLEAN | If true , the engine will wait for garbage collection tasks to finish before suspending the engine. (Default: false ) |
Returns#
A table with the following columns:
Column | Type | Description |
---|---|---|
NAME | STRING | The name of the engine. Must be between 3 and 50 characters long. Valid characters are: a-z , A-Z , 0-9 , and _ . |
MESSAGE | STRING | A message indicating the result of the operation. |
Example#
Use the api.create_engine()
procedure to create a new RAI engine:
#-- Create a new engine 'my_rai_engine' of size 'HIGHMEM_X64_S' configured to
-- suspend after 60 minutes of inactivity.
CALL relationalai.api.create_engine(
'my_rai_engine',
'HIGHMEM_X64_S',
{'auto_suspend_mins': 60},
null
);
/* +---------------+----------+
| NAME | MESSAGE |
+---------------+----------+
| my_rai_engine | Success. |
+---------------+----------+ */
If an engine with the same name already exists, an error is raised.
NOTE
create_engine()
blocks until the engine is provisioned and ready for use.
This may take several minutes.
See Compute Resources for more information on managing engines.