Eclipse Ankaios Python SDK - provides a convenient Python interface for interacting with the Ankaios platform.
Project description
Ankaios Python SDK for Eclipse Ankaios
Eclipse Ankaios provides workload and container orchestration for automotive High Performance Computers (HPCs). While it can be used for various fields of applications, it is developed from scratch for automotive use cases and provides a slim yet powerful solution to manage containerized applications.
The Python SDK provides easy access from the container (workload) point-of-view to manage the Ankaios system. A workload can use the Python SDK to run other workloads and get the state of the Ankaios system.
Installation
Install via pip
pip install ankaios-sdk
Clone and Local Build
# Clone repository
git clone https://github.com/eclipse-ankaios/ank-sdk-python.git
cd ank-sdk-python
# Install in editable mode
pip install -e .
# If you plan on contributing or running tests locally
pip install -e ".[dev]"
Note:
Depending on your Linux distribution, it could be that you need to create and activate a virtual environment to run the pip commands.
Usage
After installation, you can use the Ankaios SDK to configure and run workloads and request the state of the Ankaios system and the connected agents.
Example:
from ankaios_sdk import Workload, Ankaios, WorkloadStateEnum, WorkloadSubStateEnum
# Create a new Ankaios object.
# The connection to the control interface is automatically done at this step.
ankaios = Ankaios()
# Create a new workload
workload = Workload.builder() \
.workload_name("dynamic_nginx") \
.agent_name("agent_A") \
.runtime("podman") \
.restart_policy("NEVER") \
.runtime_config("image: docker.io/library/nginx\ncommandOptions: [\"-p\", \"8080:80\"]") \
.build()
# Run the workload
ret = ankaios.apply_workload(workload)
# Get the WorkloadInstanceName to check later if the workload is running
if ret is not None:
workload_instance_name = ret["added_workloads"][0]
# Request the execution state based on the workload instance name
ret = ankaios.get_execution_state_for_instance_name(workload_instance_name)
if ret is not None:
print(f"State: {ret.state}, substate: {ret.substate}, info: {ret.additional_info}")
# Wait until the workload reaches the running state
ret = ankaios.wait_for_workload_to_reach_state(
workload_instance_name,
state=WorkloadStateEnum.RUNNING,
timeout=5
)
if ret:
print("Workload reached the RUNNING state.")
# Request the state of the system, filtered with the agent name
complete_state = ankaios.get_state(
timeout=5,
field_masks=["workloadStates.agent_A"])
# Get the workload states present in the complete_state
workload_states_dict = complete_state.get_workload_states().get_as_dict()
# Print the states of the workloads:
for workload_name in workload_states_dict["agent_A"]:
for workload_id in workload_states_dict["agent_A"][workload_name]:
print(f"Workload {workload_name} with id {workload_id} has the state "
+ str(workload_states_dict["agent_A"] \
[workload_name][workload_id].state))
Contributing
This project welcomes contributions and suggestions. Before contributing, make sure to read the contribution guideline.
License
Ankaios Python SDK is licensed using the Apache License Version 2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ankaios_sdk-0.5.0rc2.tar.gz.
File metadata
- Download URL: ankaios_sdk-0.5.0rc2.tar.gz
- Upload date:
- Size: 50.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aab5c879e39bb34cfda1635e5163eafbc24bb42e4f75567becdfef3d54810d95
|
|
| MD5 |
3c93ffd6414917ed832e15d960178d1a
|
|
| BLAKE2b-256 |
44e1843fce48610a131d1d38ba90a7d880690db8c8bd8e96878a5033673b6640
|
Provenance
The following attestation bundles were made for ankaios_sdk-0.5.0rc2.tar.gz:
Publisher:
publish.yml on eclipse-ankaios/ank-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ankaios_sdk-0.5.0rc2.tar.gz -
Subject digest:
aab5c879e39bb34cfda1635e5163eafbc24bb42e4f75567becdfef3d54810d95 - Sigstore transparency entry: 146945551
- Sigstore integration time:
-
Permalink:
eclipse-ankaios/ank-sdk-python@40bd0ecb0d4306895eb6bda011b4afb2ba9655fd -
Branch / Tag:
refs/tags/v0.5.0-rc2 - Owner: https://github.com/eclipse-ankaios
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40bd0ecb0d4306895eb6bda011b4afb2ba9655fd -
Trigger Event:
push
-
Statement type:
File details
Details for the file ankaios_sdk-0.5.0rc2-py3-none-any.whl.
File metadata
- Download URL: ankaios_sdk-0.5.0rc2-py3-none-any.whl
- Upload date:
- Size: 66.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1bcaea34a2b5f1c40faf81ab8c8b24faa31c6ac0f3412283e2dab1b0b5a266a
|
|
| MD5 |
e690a8cf3bff20fff4b5cf8a5b7a40be
|
|
| BLAKE2b-256 |
531502e225039eb1342c2f0ac360c2cf799bedfbb28a0a04b106be4245c9ac4b
|
Provenance
The following attestation bundles were made for ankaios_sdk-0.5.0rc2-py3-none-any.whl:
Publisher:
publish.yml on eclipse-ankaios/ank-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ankaios_sdk-0.5.0rc2-py3-none-any.whl -
Subject digest:
b1bcaea34a2b5f1c40faf81ab8c8b24faa31c6ac0f3412283e2dab1b0b5a266a - Sigstore transparency entry: 146945553
- Sigstore integration time:
-
Permalink:
eclipse-ankaios/ank-sdk-python@40bd0ecb0d4306895eb6bda011b4afb2ba9655fd -
Branch / Tag:
refs/tags/v0.5.0-rc2 - Owner: https://github.com/eclipse-ankaios
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40bd0ecb0d4306895eb6bda011b4afb2ba9655fd -
Trigger Event:
push
-
Statement type: