Composing AI Inference pipelines based on OSCAR services with Elyra in EGI Notebooks¶

In this documentation, we provide a hands-on guide to using Elyra , an AI-centric extension for Jupyter Notebooks , within EGI Notebooks.
This tutorial will focus on:
how to use Elyra in EGI Notebooks
how to clone repositories using Elyra
how to interact with OSCAR, using the EGI Notebook Token.
how to deploy a pipeline to utilize inference services using OSCAR.

We will walk through the entire process, from setting up the initial environment to running specific OSCAR services like the Cowsay and others.
For a complete view of the repository containing these examples, please refer to the GitHub README.
1. Setting up the environment¶
1.1 Accessing EGI notebooks¶
The first step is to access the EGI Notebooks service.
Then choose the preferred server option. We will select Default EGI environment
:

For additional information on using EGI Notebooks, refer to the official documentation.
1.2 Importing OSCAR Elyra from Github¶
To get started, you will need to clone the repository that contains the example files for Elyra and OSCAR services: https://github.com/ai4os/ai4-compose
You can use the Elyra git tool on the left side panel to clone the repository in the EGI Notebooks environment. This repository contains various examples, including those for Elyra, such as Cowsay, Grayify, and Plants-Theano.


2. Prerequisites for all the examples¶
2.1 Using OSCAR in Your Workflow¶
To use nodes that rely on OSCAR, you need to invoke a service through an OSCAR client. First, create your own OSCAR client, configuring it with the necessary credentials and parameters to interact with an OSCAR cluster.
2.2 Setting Up an OSCAR Client¶

To set up an OSCAR client, obtain the OSCAR endpoint. For AI4EOSC, the endpoint is:
https://inference.cloud.ai4eosc.eu
The ID parameter is optional.
By default, the EGI notebook assigns a token automatically. However, if you cannot retrieve a token from an EGI notebook, you need to generate a refresh token from the EGI token page:
Follow these steps to generate a refresh token:
Authenticate on the EGI portal.
Click the button to create a refresh token.
Copy the generated refresh token.
Once the client is set up, you can seamlessly integrate OSCAR nodes into your workflow.
2.3 Configuring the OSCAR Client¶
Before running any example, ensure your OSCAR client is properly configured. You may need to set environment variables such as:
Endpoint: The URL of the OSCAR inference service.
ID (optional): The identifier for the OSCAR service.
Token file path: The location of the refresh token, if applicable.
Once configured, you can execute workflows and use OSCAR nodes within your pipeline.
3. Deploying a pipeline¶
3.1 Running the Cowsay Example¶
Now let’s get our cow to talk! Follow these steps to set up the workflow in Elyra:
Use the cowsay service node and connect it to the previous node (if the node is not already connected).
Pass the
credentials.json
and the text for the cow (eg.moo
) as environment variables.

Use the start button to execute the pipeline

After setting up the environment variables, proceed to the notebook within this node. Once executed, the notebook should display the cow uttering the text you provided.

3.2 Additional Examples: Grayify and Plants-Theano¶

You have more examples available in the Github repo to test the composing of functions for inference with OSCAR.
For all the examples, you’ll again need the credentials node to send the necessary variables. Additionally, other nodes will be involved to perform tasks like converting images to and from Base64 format.