Jupyter Lab is my favorite editor, in the past articles also introduced to you a lot of related resources and practical plug-ins, but this article to introduce you to the Elyra of Jupyter Lab, is absolutely the most powerful I have used no one of jupyter Lab plug-ins, Because its core function is to help us solve the very important problem in data analysis work – “build workflow”.
2. Use ElyRA to build workflow
Before installing the Elyra plugin set, please ensure that your Jupyter Lab version is 2.0 or above and that you have installed nodeJS, the dependencies required by all Jupyter Lab extensions.
Unlike normal jupyter Lab plug-ins, we can install multiple plug-ins integrated under Elyra by executing the following commands:
pip install --upgrade elyra && jupyter lab build
Copy the code
After installation, the appearance of the operation interface of your Jupyter Lab will change. Let’s first remember what the interface of our Jupyter Lab looks like before elyra installation (friends who are interested in the theme I use can install jupyter Labextension) :
After the installation and restart of Jupyter Lab, in addition to the change of jupyterlogo in the upper left corner, I also added the place selected by red box in the picture:
Let’s take a look at how to interactively “build a workflow” with Elyra.
Elyra gives us the ability to interactively organize several IPynb files into workflows. For demonstration purposes, here we create several IPynb files with simple flow code:
Code words are not easy to nonsense two sentences: need python learning materials or technical questions to exchange “click”
From the Launcher page, click on the Pipeline Editor to open the interface for interactive editing the Notebook Pipeline:
Drag and drop the corresponding step1.ipynb file directly from the sidebar:
Click the three dots on the right of the node corresponding to ipynb file in the pipeline interface to open more functional options:
Since we are in a local environment, we only need to select one of the required parameters under Properties Runtime Image:
After saving, the necessary parameters of a single node in the local environment are set. Similarly, drag and drop other IPynb files, configure the necessary parameters respectively, and then connect all nodes as shown in Figure 13:
Then click the “Run” button in the upper left corner and enter the line name to start running our workflow:
A message will also be displayed after the successful execution of the workflow:
If a workflow error occurs at a node, a very human message will be displayed:
Elyra will also help us create markdown cells for recording error messages above the ipynb error code block:
Best of all, with the %store magic command, we can pass global variables across the notebook without having to write out the previous node’s result file:
Convert a variable to a global variable across the kernel using the %store variable:
Use the %store -r variable name to load the current kernel across the specified variable in the kernel global variable:
And in addition to the core functions of structures, workflow, elyra there are many other practical function, interested friends can go to the official document (elyra. Readthedocs. IO/en/latest /)…
As a Python developer, I spent three days to compile a set of Python learning tutorials, from the most basic Python scripts to Web development, crawlers, data analysis, data visualization, machine learning, etc. These materials can be “clicked” by the friends who want them