Compute reference
The Compute
class is designed to faciliate the management of compute profiles
and placeholders within Edge, along with their associated resources. By
employing CRUD operations, this class simplifies the process of configuring
compute profiles, which are essential in determining the appropriate virtual
machine specifications for running applications. Moreover, it facilitates the
use of placeholders, enabling the pre-launch of virtual machines to expedite
application startup times.
# List app profiles
[1]: edge.compute.list_app_profiles()
[
AppProfile(
uid='1488ac82-8e38-11ee-84c0-a3b1666a7dea',
profile_id='edge.dashboard',
name='Dashboard (2 CPU, 2 GB RAM)',
instance_name='t3.small',
cpu=2.0,
gpu=0,
memory=2.0,
built_in=True,
status=<AppProfileStatusEnum.Ready: 'ready'>,
disable=False
)
]
# List placeholders
[2]: edge.compute.list_placeholders()
[
AppPlaceholder(
uid='049dbcfc-8ec6-11ee-8e98-1388c5d96f68',
name='medium',
profile_id='edge.medium',
quantity=1,
disable=False
)
]
Constructor
Constructing these yourself is not recommended. You should make an
EdgeSession and access the .compute
property.
Methods
list_instance_types
list_instance_types() -> list(dict)
List instance types in this organization.
Returns
list(dict) List of instance types in the organization.
retrieve_instance_type
retrieve_instance_type(instance_name) -> dict
Retrieve an instance type.
Parameters
- instance_name (str)
The name of the instance type to retrieve.
Returns
dict The object corresponding to the instance type.
list_placeholders
list_placeholders() -> list(AppPlaceholder)
List app placeholders in this organization.
Returns
list(AppPlaceholder) AppPlaceholder.
retrieve_placeholder
retrieve_placeholder(placeholder_uid) -> AppPlaceholder
Get a placeholder in this organization.
Parameters
- placeholder_uid (str)
The uid of the placeholder to retrieve.
Returns
AppPlaceholder The object corresponding to the placeholder.
create_placeholder
create_placeholder(data)
Create a placeholder in this organization.
Parameters
- data (AppPlaceholder)
An AppPlaceholder to create. The uid field will be ignored.
update_placeholder
update_placeholder(placeholder_uid, data)
Updates a placeholder in this organization.
Parameters
- placeholder_uid (str)
The uid of the placeholder. - data (AppPlaceholder)
Updated placeholder data. The uid field will be ignored.
remove_placeholder
remove_placeholder(placeholder_uid)
Delete a placeholder in this organization.
Parameters
- placeholder_uid (str)
The profile id of the profile to remove.
list_app_profiles
list_app_profiles() -> list(AppProfile)
List app profiles in this organization.
Returns
list(AppProfile) AppProfiles.
retrieve_app_profile
retrieve_app_profile(profile_id) -> AppProfile
Get an app profile in this organization.
Parameters
- profile_id (str)
The profile to retrieve.
Returns
AppProfile The object corresponding to the profile.
create_app_profile
create_app_profile(profile_id, data)
Create an app profile in this organization.
Parameters
- profile_id (str)
The profile id of the new profile. - data (AppProfile)
An AppProfile to create. The status and UID fields will be ignored. The built_in field will be set to False and the status will be set to pending.
update_app_profile
update_app_profile(profile_id, data)
Update an app profile in this organization.
Parameters
- profile_id (str)
The profile id of the profile. - data (AppProfile)
Updated app profile data.
remove_app_profile
remove_app_profile(profile_id)
Delete an app profile in this organization.
Parameters
- profile_id (str)
The profile id of the profile to remove.