Skip to main content

ArmoniK.Api Python package

This folder contains the necessary scripts to generate the ArmoniK.Api Python package. Please note that while the package generation is platform dependent, the generated package should be compatible with Linux and Windows.

Install the Python Package from PyPI

At each release, we provide a prepackaged version of ArmoniK.Api available on PyPI here : https://pypi.org/project/armonik. To install the package to your current Python environment, you can use pip :

pip install armonik

Linux / WSL

How to generate

Requirements :

  • Python >= 3.7
  • Python3-venv
  • Pip3
  • Bash

If the python command doesn't link to python3 on your system, you may be able to install the package python-is-python3, which links python to python3.

To generate the package from sources, run the proto2python.sh script from its folder. You need to specify a directory where the virtual environment used for the build will be located. For example the following command will generate the packages and will create the build environment "pyvenv" in the current user's home directory:

./proto2python.sh ~/pyvenv

3 folders will be created :

  • generated : contains the source files used to create the package
  • build : contains the source files used to create the wheel package
  • pkg : contains the sdist and wheel packages

Instead of running the script you can install the armonik package in "editable" mode, allowing you to make changes to the source code, and the changes will be reflected immediately without reinstalling the package.

pip install -e ./packages/python

How to install the generated package

From this directory, use the following command:

pip install pkg/armonik*.whl

The generated package will be installed to your current python environment

Windows

Coming soon

Tests

Test Environment Setup

Before running tests, ensure the following setup steps are completed:

  1. Install Dependencies:
sudo apt install dotnet-sdk-6.0 jq
  1. Launch the Mock Server:

Verify that port 5000 is available (Armonik and the mock server communicate on the same port, uninstall armonik if necessary):

lsof -i :5000
  1. Launch the server from the project's root directory in a separate terminal:
cd packages/csharp/ArmoniK.Api.Mock
dotnet run

Test Environment Summary

The test environment utilizes a mock endpoint to assert if the ArmoniK service has been triggered. It leverages the requests library to query the /calls.json endpoint, examining the JSON response to validate the count of remote procedure calls made to specific services and methods

curl localhost:5000/calls.json | jq

In prevision of the API test, run the following command:

curl localhost:5000/calls.json | jq '.Tasks'

You should have as output:

{
  "GetTask": 0,
  "ListTasks": 0,
  "GetResultIds": 0,
  "CancelTasks": 0,
  "CountTasksByStatus": 0,
  "ListTasksDetailed": 0,
  "SubmitTasks": 0
}

Configure gRPC channel and test API calls

Once the endpoint runs, you can initiate a gRPC channel to it with a Python client.

Below is an example using a Tasks client and calling the list_tasks method:

import grpc
import armonik.client
with grpc.insecure_channel("localhost:5001") as channel:
    tasks_client = ArmoniKTasks(channel)
    tasks.client.list_tasks()

Port 5001 is actually ArmoniK's control-plane endpoint.

For the sake of simplicity, the example gRPC channel here is an insecure one. You should never do that in production environment.

Check if API call was successful

Execute the Python code snippet above and re-run command:

curl localhost:5000/calls.json | jq '.Tasks'

You should have as output:

{
  "GetTask": 0,
  "ListTasks": 0,
  "GetResultIds": 0,
  "CancelTasks": 0,
  "CountTasksByStatus": 0,
  "ListTasksDetailed": 1,
  "SubmitTasks": 0
}

You can see that attribute ListTasksDetailed was incremented, meaning that the API effectively handled your call !

WARNING

Note for Users

Starting from gRPC version 1.57 and onward, it is necessary to explicitly specify the default authority when creating the gRPC channel. more details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

armonik-3.29.2.tar.gz (90.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

armonik-3.29.2-py3-none-any.whl (149.2 kB view details)

Uploaded Python 3

File details

Details for the file armonik-3.29.2.tar.gz.

File metadata

  • Download URL: armonik-3.29.2.tar.gz
  • Upload date:
  • Size: 90.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for armonik-3.29.2.tar.gz
Algorithm Hash digest
SHA256 7524e7f25ca2454487a83ea8d0c5975844979cb0567d802b4e7e0bd02370dbbe
MD5 72458da5c5c240047088c4bb6271a25e
BLAKE2b-256 fc499a7938ebfff4a9e1794e0a067aaecace274272269d7e05dfa64855f184ec

See more details on using hashes here.

File details

Details for the file armonik-3.29.2-py3-none-any.whl.

File metadata

  • Download URL: armonik-3.29.2-py3-none-any.whl
  • Upload date:
  • Size: 149.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for armonik-3.29.2-py3-none-any.whl
Algorithm Hash digest
SHA256 650f67f7c188bb41f6389ccc9d7a65d943efc4b977bd923765e70af5ee796d71
MD5 f0d4fc683e955fce7b1acaac02eff637
BLAKE2b-256 1294a817001fd3bd27ff1921000d660aa77197b86431ed5e9866758567141372

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.29.2 This release

2 files

3.29.1

2 files

3.29.0

2 files

3.28.3

2 files

3.28.2

2 files

3.28.1

2 files

3.28.0

2 files

3.27.0

2 files

3.26.1

2 files

3.26.0

2 files

3.25.0

2 files

3.24.0

2 files

3.23.0

2 files

3.22.0

2 files

3.21.0

2 files

3.20.0

2 files

3.19.0

2 files

3.18.1

2 files

3.18.0

2 files

3.17.1

2 files

3.17.0

2 files

3.16.2

2 files

3.16.1

2 files

3.16.0

2 files

3.15.1

2 files

3.15.0

2 files

3.14.0

2 files

3.13.2

2 files

3.13.1

2 files

3.13.0

2 files

3.12.0

2 files

3.11.0

2 files

3.10.0

2 files

3.9.2

2 files

3.9.0

2 files

3.8.2

2 files

3.8.1

2 files

3.8.0

2 files

3.7.2

2 files

3.6.1

2 files

3.6.0

2 files

3.5.3

2 files

3.5.2

2 files

3.5.1

2 files

3.5.0

2 files

3.4.0

2 files

3.3.0

2 files

3.2.1

2 files

3.2.0

2 files

3.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page