airML — Distributed and Decentralized Deployment of ML models at scale

Sahan Dilshan
4 min readJul 23, 2021

airML is now fully integrated with all KBox features. From this blog, I’m going to discuss the newest features of airML and how to use and integrate these newest features into your project. airML can be used to Distributed and Decentralized Machine Learning models at scale. You can read more about airML from here. From this blog, I’m only going to discuss the newest features of the airML and how to use them on your project.

before we dive in, make sure you have a good understanding of KBox and have installed the latest version of the airML.

pip install -i https://test.pypi.org/simple/ airML

** Note: Currently these latest airML features are under testing phase and once we finalize and test all the features, airML will be uploaded to pypi.org officially.

Execute Directly via Terminal

The major and the most important feature of the airML is that it can be now directly executed from the terminal. The earlier version of the airML can only be used inside a python environment(project). But with the new release, users have the ability to execute the KBox command through the airML directly from the terminal.

Let’s compare the oldest and the newest versions with the list command. In the earlier version (v0.0.1), you have to follow these steps just to list down all the knowledge bases of KBox.

  1. First enter to a python environment
  2. Then import the airML package
  3. Execute the list function.
import airMLresult = airML.list(False)
print(result)

But with the newest version, the user doesn’t have to follow these unnecessary steps ever again. Just open up a terminal and type,

airML list

Voila, that’s it. Really simple. You will get the exact same output as if you were to execute this command in KBox. Unlike the previous version, the current airML supports all the KBox commands. You can refer to this document to have a good understanding of KBox commands. This is another extra additional feature.

you can easily execute any KBox command from airML as follows,

airML <KBox_command> [option]
ex:
airML list
airML list kns
airML install <url>
airML install kb <kb-url>
....
....
airML r-dir
airML version

** Note: If you want to execute airML inside your python project, please follow this documentation here.

JSON Message Response

The second major upgrade is the JSON responses. Actually, this feature is not implemented on airML. it was implemented on top of KBox to be used in airML. The earlier version of airML just returns the output of the KBox command in a plain-text and unformatted version. When a user use a function like list(), install()... he/she just gets whatever the unformatted output it's getting from the KBox. The user can not extract any valuable information from this output. Therefore this JSON message response functionality was implemented. Let’s also compare this faeture with the previous airML version as well.

import airMLairML.list()output
KBox KNS Resource table list
##############################
name,format,version
##############################
http://purl.org/pcp-on-web/dbpedia,kibe,c9a618a875c5d46add88de4f00b538962f9359ad
http://purl.org/pcp-on-web/ontology,kibe,c9a618a875c5d46add88de4f00b538962f9359ad

As you can see, about output cannot be formatted properly in order to extract some information. Now let’s look at the latest airML version,

airML list -o jsonoutput
{
"status_code": 200,
"message": "visited all KNs.",
"results": [
{
"name": "http://purl.org/pcp-on-web/dbpedia",
"format": "kibe",
"version": "c9a618a875c5d46add88de4f00b538962f9359ad"
},
{
"name": "http://purl.org/pcp-on-web/ontology",
"format": "kibe",
"version": "c9a618a875c5d46add88de4f00b538962f9359ad"
}
]
}

As you can see, this output is properly formatted as a JSON string, so that the user can just convert this output into a JSON object and extract any information in a second. To get the output as a JSON response, the user just has to append -o json a sub-parameter at the end of the KBox command. As I mentioned earlier, this is more of a KBox feature even though I discuss it here. But the main purpose of that feature is to make it easier to integrate KBox easily with airML.

**Note: This -o json subparameter only works with (only returns json response) list, install, remove, locate, info, search, r-dir, version commands. It won’t return any JSON output when you use this command with other KBox commands.

These are the things that I want to discuss with you from this blog. I hope now you have a better understanding of the newest features of airML and how easy it is to use airML now compare to the previous version. Feel free to contact me anytime regarding any issue you face while using these new airML features.

--

--