<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kiersten Stokes on Medium]]></title>
        <description><![CDATA[Stories by Kiersten Stokes on Medium]]></description>
        <link>https://medium.com/@kiersten.stokes?source=rss-bae7063531fe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LnQmAkR_WHH-MALm0y7rsA.jpeg</url>
            <title>Stories by Kiersten Stokes on Medium</title>
            <link>https://medium.com/@kiersten.stokes?source=rss-bae7063531fe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:24:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kiersten.stokes/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build Versatile Pipelines in Elyra using Pipeline Parameters]]></title>
            <link>https://medium.com/codait/build-versatile-pipelines-in-elyra-using-pipeline-parameters-5634f8d5ae8d?source=rss-bae7063531fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/5634f8d5ae8d</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[kubeflow-pipelines]]></category>
            <category><![CDATA[elyra]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Kiersten Stokes]]></dc:creator>
            <pubDate>Wed, 04 Jan 2023 13:43:32 GMT</pubDate>
            <atom:updated>2023-01-04T13:43:32.641Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Jean Lafitte National Park, Louisiana" src="https://cdn-images-1.medium.com/max/980/1*zNE7PdMR9vj_hqJE14IeVA.jpeg" /><figcaption>Jean Lafitte National Park, Louisiana</figcaption></figure><p>The <a href="https://github.com/elyra-ai/elyra">Elyra</a> extension for JupyterLab enables the creation, configuration and submission of machine learning pipelines with its interactive, no-code <a href="https://elyra.readthedocs.io/en/stable/getting_started/overview.html#ai-pipelines-visual-editor">Visual Pipeline Editor</a>. Based on feature requests received in <a href="https://elyra.readthedocs.io/en/stable/getting_started/getting-help.html">Elyra’s community channels</a>, we’ve extended the pipeline editor in <a href="https://github.com/elyra-ai/elyra/releases/tag/v3.14.0">Elyra version 3.14</a> to support<em> pipeline parameters </em>for Kubeflow Pipelines. In this article, we’ll cover what pipeline parameters are, why they are useful, and present an example of how to define and use parameters in Elyra pipelines.</p><blockquote>Elyra does not currently support pipeline parameters for Apache Airflow runtime environments and, as a result, also does not support them in “Generic” pipelines that can run in either Apache Airflow or Kubeflow Pipelines runtimes.</blockquote><h3>Pipeline Parameters</h3><p>Pipeline parameters are typed variables that are defined before a pipeline is run. They allow for the customization of pipeline node inputs without the need to edit the pipeline directly in the pipeline editor. As a trivial example, consider a pipeline that has a node that analyzes a dataset. The node has a single input property, dataset_url, which is a string that represents the remote location of a dataset to be analyzed. This input property directly affects the output of the node and the pipeline as a whole. In this example, the pipeline is designed to be run multiple times, each time with a different value for dataset_url. For example, the pipeline may need to be run each week on data that is stored at a url that self-describes its timestamp information.</p><p>To accomplish this without parameters, the pipeline — more specifically, the input to the relevant node — would have to be modified in the pipeline editor and then submitted for execution or exported at least once for each change. This is because values for node inputs cannot be changed once the pipeline is compiled. Of course, this process gets much more complicated for pipelines that have many nodes, each with its own set of properties that need to be customized for each run.</p><p>Fortunately, this process is greatly simplified by using parameters. When thinking of a pipeline as being represented as a function, pipeline parameters can be considered as arguments to that function. With this model in mind, a single pipeline can be run multiple times simply by supplying new values for any number of arguments. The below snippet is an example of the code generated by Elyra when selecting “Python DSL” as the export format in the pipeline editor. As you can see, the pipeline quite literally is represented as a function with parameters as its arguments. The value provided as the default for the customizable_url argument is configurable per run.</p><pre>@kfp.dsl.pipeline(name=&quot;modified_demo&quot;)<br>def generated_pipeline(<br>    customizable_url: str = &quot;https://...&quot;<br>):<br>    # Task for node &#39;Analyze dataset&#39;<br>    task_774bcb05_a32c_4c = factory_8e4384f422a088e4814024df79(<br>        dataset_url=customizable_url,<br>    )</pre><blockquote>For more information on Elyra’s export mechanism for Kubeflow Pipelines, see <a href="https://medium.com/@ptitzler/be47efa619d8?source=friends_link&amp;sk=701085dc076de0c40b1c198d987ce91e">this previous blog post.</a></blockquote><h3>Parameterizing Pipelines in Elyra</h3><p>The Elyra Visual Pipeline Editor (VPE) interface includes the palette (on the left), the canvas (in the center), and the properties panel (on the right). The properties panel itself has three tabs: Pipeline Properties, Pipeline Parameters, and Node Properties, all shown below.</p><figure><img alt="Screenshot of the Elyra Visual Pipeline Editor with the open properties panel." src="https://cdn-images-1.medium.com/max/1024/1*nmBygVfbP7r-iiLQ6WNoIg.png" /><figcaption>The Elyra Visual Pipeline Editor &amp; panels</figcaption></figure><blockquote>Note that the <em>Pipeline Parameters</em> tab in the properties panel will not be present for runtime environments that do not support pipeline parameters, such as Apache Airflow.</blockquote><p>In this example, we will create a pipeline that includes both a custom node and a generic node in order to illustrate how parameters work for each type. As shown in the screenshot above, a custom Download data node will download a dataset from a provided url and save it in a shared location, and the generic analyze Notebook node will load and perform analysis on the data saved by its parent node.</p><h4>Defining Parameters</h4><p>Our pipeline will require two parameters: one for the custom node and one for the generic node. The custom node has an input property, url, that downloads the data at the specified location via curl. The generic node will accept a parameter that defines a batch size for the data being analyzed. We’ll first define these parameters in the Pipeline Parameters tab of the properties panel. To start, click Add in the parameters tab. The <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipelines.html#defining-pipeline-parameters">attributes needed to define a single parameter</a> are displayed. For Kubeflow Pipelines, this includes a parameter name, an optional description, the parameter type, an optional default value that can be overridden as needed during pipeline export or submit, and a checkbox to indicate whether the parameter requires a value.</p><figure><img alt="Screenshot of the pipeline parameter panel in the Visual Pipeline Editor." src="https://cdn-images-1.medium.com/max/1024/1*RhCDEVxt4rjVc2B5YvpCbg.png" /><figcaption>An empty pipeline parameter (left) and a fully-defined parameter (right)</figcaption></figure><p>In the above screenshot (left), you can see that certain validation criteria must be met. For Kubeflow Pipelines, the parameter name must be a valid Python identifier name excluding Python keywords (class, def, global, etc.), as specified in the tooltip for the Name attribute.</p><p>The available parameter types are a subset of the Kubeflow Pipelines base types. Elyra currently supports Bool, Float, Integer and String. We’ll start by defining a String-type parameter, customizable_url, to use as input to the custom node’s url property (above screenshot, right). We will also define a second parameter, an Integer-type parameter called batch_size that will be used by the generic node. This parameter will not be required, and we will set a default value of 1000.</p><h4>Assigning Parameters to Node Inputs</h4><p>Now it’s time to assign these parameters to be used by their corresponding nodes. First, select the Download data node and open the properties panel to the Node Properties tab. For the Url input property, select the first dropdown box that enumerates the input formats that this property can accept. Choose the “Please select a parameter to use as input” option. The second dropdown box is now populated with a list of compatible parameters that can be used for this input property. Notice that only customizable_url is available to select, even though we also defined the batch_size parameter. This is intentional, as only parameters that are the same type as that defined for the property in that node’s component definition can be selected. In the below combined screenshot, you can see that the Url input type is defined as String, the same type as the parameter. We will select the customizable_url parameter for the Url property and save the pipeline.</p><figure><img alt="A pipeline parameter is associated with a custom node, making its value available to the component that implements the node." src="https://cdn-images-1.medium.com/max/1024/1*NLjg_7NUpqGyIskVCLhoqg.png" /><figcaption>The “Download data” `Url` input property parameter options (left) and the node’s truncated component definition (right)</figcaption></figure><p>Parameters are referenced differently for generic nodes. Because generic components are file-based and do not have pre-defined component definitions, parameters are passed to these nodes by setting them as environment variables in the node container. Due to constraints imposed by environment variables, the parameter value will appear as a string when accessed in the generic node regardless of the parameter type that was selected. For that reason, every defined parameter will be available to select in a generic node’s Pipeline Parameters input property, as shown in the screenshot below. We’ll select to pass only the batch_size parameter to this node.</p><figure><img alt="The `batch_size` pipeline parameter is associated with a generic Jupyter notebook node, making its value available as an environment variable." src="https://cdn-images-1.medium.com/max/1024/1*TCBUmCNxuw7G95Mto7nN3A.png" /><figcaption>Generic node properties, including the Pipeline Parameters input property</figcaption></figure><blockquote>For runtime environments that do not support pipeline parameters, Pipeline Parameters will not show up in the input properties for generic nodes. Similarly, the “Please select a parameter to use as input” option will not show up in the dropdown for custom node input properties.</blockquote><h4>Exporting and Submitting Parametrized Pipelines</h4><p>Now that all the relevant node and pipeline properties have been configured, it is time to prepare the pipeline for execution. Elyra has two options for this: <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipelines.html#exporting-a-pipeline-from-the-visual-pipeline-editor">export</a> and <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipelines.html#running-a-pipeline-from-the-visual-pipeline-editor">submit</a>.</p><blockquote>Elyra also supports <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipelines.html#exporting-a-pipeline-from-the-command-line-interface">exporting</a> and <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipelines.html#running-a-pipeline-from-the-command-line-interface">submitting</a> pipelines via the CLI. It is currently only possible, however, to customize pipeline parameters using the Visual Pipeline Editor (VPE), as shown in the example here.</blockquote><p>In this example, we will illustrate how to customize parameters during pipeline export from the VPE, but the method by which to do so is much the same for pipeline submission. After clicking the export button, the export dialog shows up that includes selections for runtime configuration and export format. We will select Python DSL for this example. As shown in the below screenshot, any parameters that have been referenced by nodes also appear in this dialog box.</p><figure><img alt="Screenshot of the pipeline export dialog. For each parameter the default value is displayed." src="https://cdn-images-1.medium.com/max/830/1*qtygygFrPLdQGlQyxzmbVw.png" /><figcaption>Export dialog including pipeline parameters assigned to node properties</figcaption></figure><blockquote>Note that, in this case, all parameters that we defined have been referenced by a pipeline node. Any parameters that are defined in the Pipeline Parameters panel but not referenced by any generic or custom node will not show up in the export or submission dialog.</blockquote><p>Any default value that has been defined for a parameter will show up for that parameter as a placeholder in the value input box. A value can be entered here to override the defined default value, if desired. In this case, we will enter a new value for customizable_url but keep the default value for batch_size (shown below). Click OK to begin the export process.</p><figure><img alt="Screenshot of the pipeline export dialog. A custom value is assigned to one of the pipeline parameters." src="https://cdn-images-1.medium.com/max/830/1*GZsfR-RQ5Rr0friChbIEag.png" /><figcaption>Overriding the default value for the `customizable_url` parameter</figcaption></figure><blockquote>If the parameter is marked as required and neither a default value nor a value at submission time is provided, the OK button will be unavailable to click until a value is entered.</blockquote><p>Once export has completed, we can view the representation of the parametrized pipeline as Python code. As seen in the snippet below, the value provided during export for customizable_url has replaced the parameter default value, whereas the default value provided for batch_size is used. Each parameter is type-hinted according to the corresponding Kubeflow Pipelines base type indicated for the parameter. Each node is represented by a variable prefixed with task_ . The parameters referenced by each node are passed to the task function as arguments. In order to allow arguments to be passed to generic node tasks, inputs to these tasks are defined in the component definition that appears in the same file.</p><pre>@kfp.dsl.pipeline(name=&quot;parameters-ex&quot;)<br>def generated_pipeline(<br>    customizable_url: str = &quot;https://my-cloud-storage/data/2022/12/26&quot;,<br>    batch_size: int = 1000,<br>):<br><br>    # Task for node &#39;Download data&#39;<br>    task_057d9c11_01f9_462a_be4e_47886f108d8b = (<br>        factory_bcf3d5779dce44765a282(<br>            url=customizable_url,<br>            curl_options=&quot;&quot;&quot;--location&quot;&quot;&quot;,<br>        )<br>    )<br><br>    # Task for node &#39;analyze&#39;<br>    task_b7de9c8c_a672_44c4_bb2d_323daaec3660 = (<br>        factory_9621724082033a96dd013b(<br>            batch_size=batch_size,<br>        )<br>    )</pre><p>Below is the excerpt of the component definition for the generic node that appears towards the beginning of the generated code. As shown, a separate input is defined for each parameter referenced by the generic node, with the input name having the same name as the name of the parameter.</p><pre>component_def_9621724082033a96dd013b = &quot;&quot;&quot;<br>name: Run a file<br>description: Run a Jupyter notebook or Python/R script<br><br>inputs:<br>- {name: batch_size, type: Integer, description: &#39;Number of samples processed before the model is updated&#39;, default: 1000, optional: true}<br><br>implementation:<br>  container:<br>    image: pytorch/pytorch:1.4-cuda10.1-cudnn7-devel<br>    command: [sh, -c]<br>    args:<br>    - |<br>      batch_size=&quot;$0&quot;<br>      sh -c &quot;mkdir -p ./jupyter-work-dir &amp;&amp; cd ./jupyter-work-dir&quot;<br>      sh -c &quot;echo &#39;Downloading https://raw.githubusercontent.com/elyra-ai/elyra/main/elyra/kfp/bootstrapper.py&#39; &amp;&amp; curl --fail -H &#39;Cache-Control: no-cache&#39; -L https://raw.githubusercontent.com/elyra-ai/elyra/main/elyra/kfp/bootstrapper.py --output bootstrapper.py&quot;<br>      sh -c &quot;echo &#39;Downloading https://raw.githubusercontent.com/elyra-ai/elyra/main/etc/generic/requirements-elyra.txt&#39; &amp;&amp; curl --fail -H &#39;Cache-Control: no-cache&#39; -L https://raw.githubusercontent.com/elyra-ai/elyra/main/etc/generic/requirements-elyra.txt --output requirements-elyra.txt&quot;<br>      sh -c &quot;echo &#39;Downloading https://raw.githubusercontent.com/elyra-ai/elyra/main/etc/generic/requirements-elyra-py37.txt&#39; &amp;&amp; curl --fail -H &#39;Cache-Control: no-cache&#39; -L https://raw.githubusercontent.com/elyra-ai/elyra/main/etc/generic/requirements-elyra-py37.txt --output requirements-elyra-py37.txt&quot;<br>      sh -c &quot;python3 -m pip install  packaging &amp;&amp; python3 -m pip freeze &gt; requirements-current.txt &amp;&amp; python3 bootstrapper.py --pipeline-name &#39;parameters-ex&#39; --cos-endpoint &#39;http://cloning1.fyre.ibm.com:30965&#39; --cos-bucket &#39;cloning1-test&#39; --cos-directory &#39;parameters-ex-1229164352&#39; --cos-dependencies-archive &#39;analyze-b7de9c8c-a672-44c4-bb2d-323daaec3660.tar.gz&#39; --file &#39;parameters/analyze.ipynb&#39; --pipeline-parameters &#39;batch_size=$batch_size&#39; --parameter-pass-method &#39;env&#39; &quot;<br>    - {inputValue: batch_size}<br><br>&quot;&quot;&quot;<br><br>factory_9621724082033a96dd013b = (<br>    kfp.components.load_component_from_text(<br>        component_def_9621724082033a96dd013b<br>    )<br>)<br></pre><p>Run the generated Python DSL to compile the representation into a YAML file that Kubeflow Pipelines understands. This YAML file can then be uploaded in the Kubeflow Pipelines UI, as we will see next.</p><blockquote>Alternatively, this pipeline can be submitted directly to Kubeflow Pipelines from the Elyra pipeline editor to the same effect.</blockquote><h4>Editing a Parametrized Pipeline in the Kubeflow Pipelines UI</h4><p>Pipelines can be uploaded to the Kubeflow Pipelines UI in YAML format. The Run parameters section shown below exposes the parameters that were defined for this pipeline. For each pipeline run, new values for each parameter can be supplied directly without the need to modify the pipeline in Elyra’s pipeline editor.</p><figure><img alt="Screenshot of the run wizard in the Kubeflow Pipelines UI" src="https://cdn-images-1.medium.com/max/1024/1*r13NtA2YEHPFfmDj9JNXQA.png" /><figcaption>Editing pipeline parameters for a pipeline run</figcaption></figure><h4>Conclusion</h4><p>Thank you for reading! You can learn more about our additional capabilities by checking out the <a href="https://elyra.readthedocs.io/en/stable/getting_started/published-resources.html">published resources</a> page of the Elyra documentation. As an open source project, we welcome community and user involvement of any kind. Find information about how you can reach out with questions and suggestions <a href="https://elyra.readthedocs.io/en/stable/getting_started/getting-help.html">here</a>, or learn more about contributing <a href="https://elyra.readthedocs.io/en/stable/developer_guide/contributing.html">here</a>. We look forward to your contributions!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5634f8d5ae8d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codait/build-versatile-pipelines-in-elyra-using-pipeline-parameters-5634f8d5ae8d">Build Versatile Pipelines in Elyra using Pipeline Parameters</a> was originally published in <a href="https://medium.com/codait">Center for Open Source Data and AI Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate your pipeline tasks with the Elyra CLI]]></title>
            <link>https://medium.com/codait/automate-your-pipeline-tasks-with-the-elyra-cli-2887df8730fb?source=rss-bae7063531fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/2887df8730fb</guid>
            <category><![CDATA[machine-lea]]></category>
            <category><![CDATA[elyra]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[cli]]></category>
            <dc:creator><![CDATA[Kiersten Stokes]]></dc:creator>
            <pubDate>Wed, 04 May 2022 16:05:16 GMT</pubDate>
            <atom:updated>2022-05-04T16:05:16.297Z</atom:updated>
            <content:encoded><![CDATA[<h3>Automate Elyra tasks using the CLI</h3><figure><img alt="Sunset over Lake Pontchartrain" src="https://cdn-images-1.medium.com/max/720/1*dhC0UH9jHJpFh3JhUxCEOA.jpeg" /><figcaption>Lake Pontchartrain, Louisiana (Photo by Rachel Boykin)</figcaption></figure><p>The <a href="https://github.com/elyra-ai/elyra">Elyra</a> JupyterLab extension makes it easy to create, manage, and run pipelines and supporting assets such as runtime configurations and runtime images with an intuitive GUI. The <a href="https://elyra.readthedocs.io/en/stable/getting_started/overview.html#ai-pipelines-visual-editor">Visual Pipeline Editor</a> enables these common data science tasks without the need for coding.</p><figure><img alt="The Elyra Visual Pipeline Editor with 4 nodes" src="https://cdn-images-1.medium.com/max/880/0*7nKWLD8kHqVK7ptL.png" /><figcaption>The Visual Pipeline Editor</figcaption></figure><p>For users that prefer a CLI or in situations where a set of otherwise tedious tasks need to be automated, the features and options available in Elyra’s CLI can be exceptionally useful. The Elyra CLI can be used to manage metadata (<a href="https://elyra.readthedocs.io/en/stable/user_guide/command-line-interface.html#managing-metadata">elyra-metadata</a>) and work with pipelines (<a href="https://elyra.readthedocs.io/en/stable/user_guide/command-line-interface.html#working-with-pipelines">elyra-pipeline</a>). These tools are part of the Elyra installation and can be used without a running JupyterLab instance. In this blog post, I’ll go over some of the available subcommands for each and cover some examples in the process.</p><h3>Managing Elyra Metadata</h3><p>In order to facilitate building and running pipelines, Elyra needs to store certain information such as <a href="https://elyra.readthedocs.io/en/stable/user_guide/runtime-conf.html#runtime-configuration">runtime configurations</a>, <a href="https://elyra.readthedocs.io/en/stable/user_guide/runtime-image-conf.html#runtime-image-configuration">runtime images</a>, <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipeline-components.html#component-catalogs">component catalogs</a>, and <a href="https://elyra.readthedocs.io/en/stable/user_guide/code-snippets.html#code-snippets">code snippets</a>. The elyra-metadata command can be used to modify this metadata using the available subcommands: list, create, update, import, export and remove.</p><p>Currently, there are four types of metadata that Elyra stores and that can be modified using the CLI: code-snippets, component-catalogs, runtimes, and runtime-images. These types are also referred to as <em>schemaspaces. </em>When running any elyra-metadata subcommand, the schemaspace name must be provided. A quick explanation of each schemaspace is shown in the table below.</p><figure><img alt="A table explaining the purpose of the 4 schemaspaces" src="https://cdn-images-1.medium.com/max/1024/1*Jgq6SIn9ybFhtd_6mAXE9w.png" /><figcaption>Elyra schemaspaces and their purposes</figcaption></figure><p>The structure of an elyra-metadata command follows the format:</p><pre>$ elyra-metadata SUBCOMMAND SCHEMASPACE [OPTIONS]</pre><p>Run elyra-metadata and its subcommands with the --help flag at any time for a summary of the usage and available subcommands covered below.</p><h4>Listing Metadata</h4><p>The list subcommand lists all the instances of the specified schemaspace. For example, run the command below to see a list of all installed runtime images.</p><pre>$ elyra-metadata list runtime-images</pre><figure><img alt="Output of the `list` subcommand for the runtime-images schemaspace" src="https://cdn-images-1.medium.com/max/1024/1*0Ixhq9D5qjeUpvC64m25tA.png" /><figcaption>Output of the `list` subcommand for the runtime-images schemaspace</figcaption></figure><blockquote>Note that the list subcommand will also display any invalid instances that may be present in the Elyra metadata storage folder, so there may be more results than expected when compared to instances that show up in the GUI. Invalid instances are indicated in the output of list with **INVALID** on the relevant row. Use the --valid-only flag to ignore invalid instances, if desired.</blockquote><p>You can also see metadata instances in their raw JSON form by supplying the --json flag to the above command. Below is the representation for an image with name new-pytorch-runtime:</p><figure><img alt="JSON representation of a single runtime image" src="https://cdn-images-1.medium.com/max/1024/1*7_uJFWltsYyc11bGcQ3oWA.png" /><figcaption>JSON representation of a single runtime image</figcaption></figure><p>The structure of an instance can be helpful to have handy when adding or modifying an instance, as it hints at which fields may need to be supplied to the create or update subcommands.</p><h4>Creating Metadata</h4><p>When using the CLI to create a new instance, the actual command used to create the instance in the screen capture displayed above would look something like this:</p><pre>$ elyra-metadata create runtime-images \<br>       --name &quot;new-pytorch-runtime&quot; <strong>\</strong><br>       --display_name &quot;Pytorch 1.4 with CUDA-runtime&quot; <strong>\</strong><br>       --description &quot;PyTorch 1.4 (with GPU support)&quot; <strong>\</strong><br>       --image_name &quot;pytorch/pytorch:1.4-cuda10.1-cudnn7-runtime&quot;</pre><p>For any subcommand, if a required parameter is not included or is improperly formatted, the output of that command will display an appropriate error message.</p><figure><img alt="Error output showing a missing parameter and other option information" src="https://cdn-images-1.medium.com/max/1024/1*zHrD8YCl5vd5HPjz-Re6Fw.png" /><figcaption>Error output showing a missing parameter and other option information</figcaption></figure><p>Two additional parameters are available for the create subcommand:</p><ul><li>--file, which takes a file path to a JSON-formatted file that contains values for the properties of a metadata instance</li><li>--json, which takes a JSON string that contains values for the properties of a metadata instance</li></ul><p>These options will be covered in more details in the following subsection.</p><h4>Updating Metadata</h4><p>The update subcommand modifies an existing instance and is similar to create in structure. Note that in the case of updates only the name parameter and the parameters for the fields that are being modified need to be supplied. The value of the name parameter is that displayed in the <em>Instance</em> column when using the list subcommand or that shown in the name field of the JSON representation of an instance. For example, to change the pull policy for the same example image:</p><pre>$ elyra-metadata update runtime-images \<br>      --name &quot;new-pytorch-runtime&quot; \<br>      --pull_policy &quot;Never&quot;</pre><p>You can review the output of the elyra-metadata list runtime-images --json command again to confirm that the pull_policy field is now set to “Never”.</p><figure><img alt="JSON representation of the updated runtime-image" src="https://cdn-images-1.medium.com/max/1024/1*N4NJrbex41EAk0CrvOwwqQ.png" /><figcaption>JSON representation of the updated runtime-image</figcaption></figure><blockquote>The <em>resource_name</em> fields of a metadata instance should not be modified in most cases. The <em>display_name</em> field and any field within the <em>metadata</em> stanza, however, are freely modifiable.</blockquote><p>The examples shown above all focus on the runtime-images schemaspace, the instances of which are quite simple. As seen in the JSON representation of a runtime image, there are only a handful of properties saved for each. In the case where the instances are more complicated, however, such as with the runtimes schemaspace, the --file and --json options can greatly simplify the creation or update of instances.</p><p>The --file option takes a file path to a JSON-formatted file that contains either the entire JSON representation of an instance (that shown with the list --json subcommand) or only the JSON that comprises the metadata stanza. For example, the file shown in the below picture represents a metadata stanza of an instance in the runtime-images schemaspace.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19ef4da9bfa26471cee5714bc89519e8/href">https://medium.com/media/19ef4da9bfa26471cee5714bc89519e8/href</a></iframe><p>Run the following command to replace the pull_policy value with Always for the instance named new-pytorch-runtime:</p><pre>$ elyra-metadata update runtime-images \<br>     --name &quot;new-pytorch-runtime&quot; \<br>     --file /path/to/metadata.json</pre><p>Review the output of the elyra-metadata list runtime-images --json command, if desired, to confirm that the appropriate change has been made. Any value supplied in the file can be overridden with a value given on the command line if the appropriate option (e.g. --image_name) is supplied. The command below changes the pull_policy to Always(as defined in the file) <strong>and</strong> changes the image_name to the image at my_repo/pytorch:1.4-cuda10.1-cudnn7-runtime, even though the image_name given in the file is different.</p><pre>$ elyra-metadata update runtime-images \<br>     --name &quot;new-pytorch-runtime&quot; \<br>     --file /path/to/metadata.json \<br>     --image_name &quot;my_repo/pytorch:1.4-cuda10.1-cudnn7-runtime&quot;</pre><p>The --json option works similar to --file, but allows the specification of the bulk JSON to be referenced as a string. Its behavior is the same as --file relative to the expected data and ability to override. This option can be helpful in situations where file creation is not available or the metadata is smaller.</p><pre>$ elyra-metadata update runtime-images \<br>     --name &quot;new-pytorch-runtime&quot; \<br>     --json &#39;{&quot;description&quot;: &quot;Pytorch 1.4 CUDA from my_repo&quot;}&#39;</pre><h4>Removing Metadata</h4><p>Remove an instance is as simple as supplying the name parameter:</p><pre>$ elyra-metadata remove runtime-images --name &quot;my_image_name&quot;</pre><h4>Exporting Metadata</h4><p>As of version 3.8, Elyra also supports bulk export and import of instances using the elyra-metadata command. Export of metadata instances allows for improved testing, simplified cloning of deployments, and ease of making backups for disaster recovery. A directory must be supplied when exporting:</p><pre>$ elyra-metadata export runtime-images --directory &quot;/tmp/foo&quot;</pre><figure><img alt="Output of the elyra-metadata `export` subcommand" src="https://cdn-images-1.medium.com/max/1024/1*5EgEzOLEszpliSOLwRbvNg.png" /><figcaption>Output of the elyra-metadata `export` subcommand</figcaption></figure><p>As noted in the output, instances are copied into a subfolder named for the <em>schemaspace of interest</em> within the given directory: /tmp/foo/runtime-images for the example above.</p><blockquote>Note that the exported metadata is not encrypted and, therefore, should be stored in an access-restricted location.</blockquote><p>Two additional flags are available to work with export:</p><ol><li>--include-invalid: include invalid instances when exporting</li><li>--clean: clean out the directory for the given schemaspace before exporting the instances; this empties the /tmp/foo/runtime-images directory before exporting the current instances</li></ol><h4>Importing Metadata</h4><p>Metadata instance import works in a similar manner and has analogous use cases. The below command imports all runtime image instances from the /tmp/foo/runtime-images directory that was created during the previous export command into the applicable metadata folder for access by Elyra:</p><pre>$ elyra-metadata import runtime-images \<br>     --directory &quot;/tmp/foo/runtime-images&quot;</pre><blockquote>Note that any subdirectories present in the supplied directory will be ignored.</blockquote><p>In the case that an imported instance has the same name as an instance that is already present in the Elyra metadata folder, the existing instance will be preferred. The --overwrite flag can be used to signal to the tool that imported instances should overwrite those already present in the case of a name collision.</p><h4>Example Use Case</h4><p>Now that we’ve covered how to use the metadata CLI tool to modify metadata, we can move into the <em>why</em>. One particularly helpful use for elyra-metadata is to use it for environment set up — for example, in a Dockerfile. In fact, Elyra uses this strategy in <a href="https://github.com/elyra-ai/elyra/tree/master/etc/docker/elyra">building its own container image</a>. Below is an excerpt from Elyra’s Dockerfile. This is a relatively simple example, but it can be easily extended to include a set of custom runtime configurations, runtime images, or additional component catalogs that you might require in your environment. This eliminates the need to manually create these metadata instances from the GUI at every start up.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f3547547c0ba13e57dff603d4396c16/href">https://medium.com/media/7f3547547c0ba13e57dff603d4396c16/href</a></iframe><p>The all-inclusive stand-alone installation (e.g. pip install elyra[all]) of Elyra includes the Kubeflow Pipelines example components, which provide an illustration of how custom components and component catalogs work. The RUN elyra-metadata command in the excerpt above ensures that these example components are available in Elyra when the container is run.</p><h3>Working with Elyra Pipelines</h3><p>Once the metadata groundwork has been laid, the <a href="https://elyra.readthedocs.io/en/stable/user_guide/command-line-interface.html#working-with-pipelines">elyra-pipeline command</a> can be used to perform pipeline tasks. The following subcommands are available for this purpose: submit, run, validate, describe, and export. The $ elyra-pipeline --help command provides a summary of the usage and meaning of these subcommands.</p><blockquote>Consider reading <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipelines.html">this page</a> in the Elyra documentation for a more in-depth discussion of some of the pipeline-related concepts referenced here.</blockquote><h4>Describing Pipelines</h4><p>The describe and validate subcommands are best used before the other three subcommands in order to check that pipelines are valid and that all the necessary prerequisites for pipeline execution are in place. The describe subcommand enables the latter by providing a short summary of the given pipeline. Among other things, this summary lists any file and component dependencies that will be referenced during pipeline construction or execution. A path to a valid pipeline file must be supplied to the describe subcommand:</p><pre>$ elyra-pipeline describe /path/to/read_and_write.pipeline</pre><blockquote>All elyra-pipeline subcommands can accept either a relative or absolute path to a pipeline file. If using a relative path, the path must be relative to the active Jupyter working directory in order to succeed.</blockquote><p>The output of describe is shown below for the read_and_write pipeline. As shown, the pipeline has one file dependency, one_line_file.txt, meaning that this file must exist and be co-located with the pipeline file whenever it is run or submitted for remote execution.</p><figure><img alt="Output of the elyra-pipeline `describe` subcommand" src="https://cdn-images-1.medium.com/max/990/1*C8QSsID_N5VM8ArGvTXjgw.png" /><figcaption>Output of the elyra-pipeline `describe` subcommand</figcaption></figure><blockquote>The above information can also be shown as JSON output, if desired, by supplying the --json flag in the describe subcommand.</blockquote><h4>Validating Pipelines</h4><p>The validate subcommand is used to run a full validation check on a given pipeline. While validation always occurs before pipeline run, submission or export, it can be useful to run validation separately in a “dry run” scenario as well:</p><pre>$ elyra-pipeline validate /path/to/read_and_write.pipeline</pre><p>If validation fails, a relevant message is displayed for each error encountered, and the command returns with a non-zero exit code.</p><blockquote>Note that this exit code rule applies to all Elyra CLI commands. An exit code of 0 indicates success, and a non-zero exit code indicates failure.</blockquote><p>Consider a case where the above command is run from a directory that is not the active Jupyter working directory. The output will look something like the following:</p><figure><img alt="Output of elyra-pipeline `validate` command with failures" src="https://cdn-images-1.medium.com/max/1024/1*yhZLWRSbzDdE3DJfNNr_AQ.png" /><figcaption>Output of elyra-pipeline `validate` command with failures</figcaption></figure><p>As noted in the validation errors listed above, Elyra can not find the notebook and script node files and their related file dependencies from this directory. After changing into the correct root directory and re-running the command, validation passes. Now the pipeline can be successfully run, submitted, or exported.</p><h4>Running Pipelines</h4><p>The run subcommand executes a <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipelines.html#generic-pipelines">generic pipeline</a> in JupyterLab. Log messages are displayed indicating the progress of node processing.</p><pre>$ elyra-pipeline run /path/to/read_and_write.pipeline</pre><blockquote>Note that pipelines that include runtime-specific components can not be executed locally. Validation will fail indicating that a runtime configuration must be supplied or any runtime-specific components removed from the pipeline.</blockquote><h4>Submitting Pipelines</h4><p>Where the run subcommand is used for local execution, the submit subcommand is the analogous command for remote pipeline execution. Elyra currently provides built-in support for <a href="https://elyra.readthedocs.io/en/stable/user_guide/runtime-conf.html#kubeflow-pipelines-configuration-settings">Kubeflow Pipelines</a> and <a href="https://elyra.readthedocs.io/en/stable/user_guide/runtime-conf.html#apache-airflow-configuration-settings">Apache Airflow</a> as remote execution engines. The submit command therefore requires that a runtime configuration metadata instance name be supplied as a parameter. Use the elyra-metadata list runtimes command to see the available runtime configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ze_rNsEyWpJKwXnL0HbuSA.png" /><figcaption>Available runtime configurations given by the elyra-metadata `list` command</figcaption></figure><p>The <em>Schema</em> column indicates the execution engine to which this instance applies, and the <em>Instance</em> column indicates the name of the instance. The latter is the value that needs to be supplied to the submit subcommand.</p><pre>$ elyra-pipeline submit /path/to/read_and_write.pipeline \<br>     --runtime-config kfp_dev_env</pre><p>If the specified --runtime-config is not compatible with the specified pipeline, an error is raised during validation. If the pipeline was successfully submitted, however, the command returns a link that you can use to monitor the progress of the pipeline and a link to the s3-based cloud storage where the pipeline run artifacts are stored.</p><blockquote>Pipeline submissions to a Kubeflow Pipelines runtime can also be monitored from the command line. The --monitor option is used to indicate that the CLI should monitor the submission for up to --monitor-timeout minutes (the default is 60). More details on how to use this option can be found <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipelines.html#running-a-pipeline-from-the-command-line-interface">here</a>.</blockquote><h4>Exporting Pipelines</h4><p>On export, Elyra performs two tasks: 1. packages dependencies for generic components and uploads them to s3-based cloud storage, and 2. generates pipeline code for the target runtime. The export subcommand, therefore, does not submit pipelines but instead prepares them for later execution by creating a runtime-specific file. It works similarly to submit, requiring a runtime configuration parameter, and also supports two additional optional parameters:</p><ol><li>--output: specifies the path and name of the exported file, defaulting to the current directory and pipeline name</li><li>--overwrite: indicates to overwrite the output file if it already exists</li></ol><pre>$ elyra-pipeline export /path/to/read_and_write.pipeline \<br>     --runtime-config kfp_dev_env \<br>     --output /path/to/exported.yaml \<br>     --overwrite</pre><p>The exported file (YAML for Kubeflow Pipelines or Python DAG for Apache Airflow) can then be manually uploaded at any time for execution.</p><h4>Example Use Case</h4><p>The elyra-pipeline CLI is great for automating pipeline processing. For example, say you have a pipeline that loads and processes data to ready it for model training. The model must be trained with the latest data set every week, meaning the pipeline must be periodically executed. With the elyra-pipeline CLI, a single command can take care of this situation.</p><pre>$ elyra-pipeline submit /path/to/read_and_write.pipeline \<br>     --runtime-config kfp_dev_env</pre><p>If you have several pipelines with the same requirements, you could create a shell script to automate the entire workflow. You can also add elyra-metadata commands as needed. The below script creates a runtime configuration and component catalog, then loops through to validate each pipeline file in the my_pipelines directory, submitting the pipeline for execution if validation succeeds. Finally, it removes the created metadata resources.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af931245d27ce2e66b28b62a42a8c8ef/href">https://medium.com/media/af931245d27ce2e66b28b62a42a8c8ef/href</a></iframe><p>The Elyra CLI tools have clearly simplified this otherwise complicated and time-consuming workflow to a single command: bash simple_script.sh.</p><h3>Conclusion</h3><p>I appreciate that you took the time to read this post, and I hope the examples given here have provided a few ideas on how you could use the Elyra CLI tools to simplify your pipeline workflows. You can learn more about Elyra’s capabilities and features by checking out our other <a href="https://elyra.readthedocs.io/en/stable/getting_started/published-resources.html">published resources</a>. If there is any functionality that you feel would be useful for Elyra to support, let us know by <a href="https://elyra.readthedocs.io/en/stable/getting_started/getting-help.html">opening an issue, reaching out in the community chatroom, or by joining our weekly community call</a>. As an open source project, we welcome contributions and feedback of any kind. We look forward to hearing from you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2887df8730fb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codait/automate-your-pipeline-tasks-with-the-elyra-cli-2887df8730fb">Automate your pipeline tasks with the Elyra CLI</a> was originally published in <a href="https://medium.com/codait">Center for Open Source Data and AI Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Apache Airflow Operators in Elyra]]></title>
            <link>https://medium.com/ibm-data-ai/getting-started-with-apache-airflow-operators-in-elyra-aae882f80c4a?source=rss-bae7063531fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/aae882f80c4a</guid>
            <category><![CDATA[elyra]]></category>
            <category><![CDATA[data-science-tutorial]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[airflow]]></category>
            <dc:creator><![CDATA[Kiersten Stokes]]></dc:creator>
            <pubDate>Thu, 17 Feb 2022 00:16:18 GMT</pubDate>
            <atom:updated>2022-02-17T16:10:41.605Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="body of water with cypress trees and Spanish moss in it" src="https://cdn-images-1.medium.com/max/900/1*qmLvmrtT-h2KfpAAELYkeg.jpeg" /><figcaption>Caddo Lake, Texas</figcaption></figure><p>With the <a href="https://github.com/elyra-ai/elyra/releases/tag/v3.6.0">release of version 3.6</a>, Elyra has made several enhancements that provide more complete support for the development of Apache Airflow workflows. In this blog post, I’ll go over the basics of Apache Airflow and how to use Elyra to create pipelines that include a variety of Apache Airflow operators.</p><blockquote>Consider reading <a href="https://medium.com/ibm-data-ai/elyra-3-3-pipelines-custom-components-and-catalogs-74cf198fdf48?source=friends_link&amp;sk=ef91a56fbbae97bbaea77ff169d549dd">this blog post</a> for a more in-depth discussion of some of the Elyra concepts referenced here, such as custom components and component catalogs, and to learn more about Elyra’s Kubeflow Pipelines support.</blockquote><h4><strong>Apache Airflow</strong></h4><p><a href="https://airflow.apache.org/">Apache Airflow</a> is an open-source workflow orchestration tool that provides for creation, execution, and tracking of workflows. A workflow, or pipeline, can be thought of as a sequence of steps taken to achieve a certain data transformation goal. Each step, also called a task, corresponds to a single unit of work in the sequence. In Apache Airflow, a workflow is represented by a <a href="https://airflow.apache.org/docs/apache-airflow/stable/concepts/dags.html">Directed Acyclic Graph (DAG)</a> where each node of the graph corresponds to a task and each edge represents the dependencies between tasks. The implementation of a task in Airflow is detailed in a re-usable Python class called an operator. Each task is therefore an instantiation of an operator. Airflow deployments come with a set of built-in operators for common tasks. Airflow can also be extended with additional operators by linking any number of <a href="https://airflow.apache.org/docs/apache-airflow-providers/index.html">provider package</a>s.</p><p>Apache Airflow is code-first, meaning that a workflow DAG and its associated operator tasks are defined programmatically. This is what makes Airflow so powerful and flexible, but it can also be a bit cumbersome for those that don’t have familiarity with Python or when writing a DAG for a very complex or very large pipeline. This is where <a href="https://elyra.readthedocs.io/en/stable/getting_started/overview.html#ai-pipelines-visual-editor">Elyra’s Visual Pipeline Editor (VPE)</a> can simplify things.</p><h4><strong>Elyra Pipelines and the VPE</strong></h4><p>The Elyra VPE makes it possible to build a pipeline without writing any code. The interface includes a palette (on the left), the canvas (in the center), and a properties panel (on the right), as shown below.</p><figure><img alt="screenshot of the Visual Pipeline Editor showing the palette with nodes on the left, the canvas with the visual pipeline in the center, and the properties panel for the chosen operator on the right." src="https://cdn-images-1.medium.com/max/1024/1*PRAy7Q3jjesr0QN8mcl5sg.png" /><figcaption>Create pipelines using the Visual Pipeline Editor</figcaption></figure><p>The palette is where the available operators (more generally referred to as components in the Elyra documentation) are listed. Assemble a pipeline by dragging components from the palette onto the canvas and connecting them as appropriate. Elyra also exposes each component’s input and output properties in the properties panel.</p><blockquote>Note that only input properties will be displayed for Airflow components (operators)</blockquote><p>As seen in the screenshot above, when building an Apache Airflow-specific pipeline, there are two types of <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipeline-components.html">components</a> available in the palette:</p><ol><li><strong>generic components</strong> for executing Jupyter notebooks, Python scripts, and R scripts. These can be seen under the <em>Elyra</em> category in the palette</li><li><strong>runtime-specific components</strong> (also called <strong>custom components</strong>) each of which corresponds to a single Airflow operator and is shown with the Apache Airflow logo to the left of its name. The set seen here are organized under a <em>Core packages</em> category</li></ol><p>Custom components are not included with Elyra by default and must therefore be managed separately using Elyra’s component catalog feature.</p><h4><strong>Component Catalogs</strong></h4><p>Elyra does not include its own component repository and relies on <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipeline-components.html#component-catalogs">component catalogs</a> and their associated connectors to manage the components available in the palette. Catalog connectors serve two purposes:</p><ol><li>retrieve a list of components that a given catalog makes available</li><li>fetch the component definition in order to expose its input and output properties</li></ol><p>Elyra provides three built-in component catalog connector types: <em>filesystem</em> <em>catalogs </em>and <em>directory</em> <em>catalogs</em>, which provide access to components stored in a filesystem either individually or together in a directory, and a <em>URL</em> <em>catalog</em> that provides access to components available via anonymous HTTP GET request. Additional connectors are available in the <a href="https://github.com/elyra-ai/examples/blob/master/component-catalog-connectors/connector-directory.md">Elyra examples repository</a>. Unlike built-in types, you must explicitly install the connector in order to access components from these connector types. If none of the pre-built connectors fit your needs, you can also build your own connector by following the instructions <a href="https://github.com/elyra-ai/examples/blob/master/component-catalog-connectors/build-a-custom-connector.md">here</a>.</p><p>Elyra version 3.6 builds on this by adding two new types of built-in catalog connectors that are Airflow-specific: an <strong>Airflow package catalog connector</strong> and an <strong>Airflow provider package catalog connector</strong>. These connectors are available in the Elyra distribution with no need to install any additional packages.</p><h4><strong>Airflow Package Catalog Connector</strong></h4><p>The <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipeline-components.html#apache-airflow-package-catalog">Airflow Package catalog connector</a> allows users access to the built-in (or ‘core’) operators for a given Airflow distribution. Some of these operators include the <em>BashOperator</em>, which executes a bash command, and the <em>EmailOperator</em>, which sends an email to a list of recipients. A full list can be found <a href="https://airflow.apache.org/docs/apache-airflow/stable/operators-and-hooks-ref.html#operators">here</a>.</p><p>To configure an Airflow package catalog, first open the ‘Component Catalogs’ panel from JupyterLab. Select the + symbol, then ‘New Apache Airflow package operator catalog’.</p><figure><img alt="screenshot of adding a catalog in JupyterLab, with a panel and search bar labeled “Component Catalogs” on the left, and a list menu of new catalog options in the center with “New Apache Airflow Package Operator Catalog” highlighted" src="https://cdn-images-1.medium.com/max/1024/1*UEcuypvHdya1qpML7y_8gQ.png" /><figcaption>Adding a catalog from the ‘Manage Component’ panel</figcaption></figure><p>Enter a name for the catalog and modify the description, if desired. The runtime is set automatically as Apache Airflow. Optionally specify one or more categories for the operators that will be retrieved by this catalog. These category names are used to organize the operators in the palette. The single category ‘<em>Core packages’</em> is assigned by default.</p><figure><img alt="screenshot of adding a new airflow package operator catalog with fields Name, Runtime, Description, category names (with an “add item” button) and Source. There is also a “Save and Close” button." src="https://cdn-images-1.medium.com/max/1024/1*rzblgbBfh7ab510OMhd9Vg.png" /><figcaption>Adding a new Airflow package operator catalog</figcaption></figure><p>Lastly, you’ll need to configure the Airflow package download URL. The URL must meet a few constraints:</p><ol><li>it must point to a built distribution (wheel) file</li><li>it must reference a location that Elyra can access using an HTTP GET request without the need to authenticate</li></ol><p>For example, for a distribution available on PyPI, open the package’s ‘Release history’ and choose your desired version.</p><figure><img alt="screenshot of PyPI release page for the apache-airflow package. on the left there is a navigation menu with “Release History” highlighted, showing the version 2.2.3 on top, released on December 21, 2021." src="https://cdn-images-1.medium.com/max/1024/1*4WLei1fbCz8jkFS1nh-AAw.png" /><figcaption>PyPI release page for the apache-airflow package</figcaption></figure><p>From the appropriate version’s page, click on the ‘Download files’ link and copy the link to the package wheel file.</p><figure><img alt="screenshot of PyPI file download page for the apache-airflow 1.10.15 package. there is a navigation menu on the left with “Download Files” highlighted. The main pane shows files to download with the options of Source Distribution and Build Distribution" src="https://cdn-images-1.medium.com/max/1024/1*ytKUoPf4hOKOWUShhVqZXg.png" /><figcaption>PyPI file download page for the apache-airflow 1.10.15 package</figcaption></figure><p>Paste the copied link into the appropriate field and click ‘Save &amp; Close’. The core operators should now be available in the VPE palette under the specified categories, which in this case is the default category, ‘<em>Core packages’</em>.</p><figure><img alt="screenshot of Palette with Airflow package operators included. on the far left, there is a component catalogs pane with a search bar and “airflow 1.10.16 core” shown, while the left hand panel shows the palette with a variety of operators. The main panel shows the statement “start your new pipeline by dragging files from the file browser pane or add custom components by clicking the button”" src="https://cdn-images-1.medium.com/max/1024/1*sYkv7FxYQfgcGlJimkjIBg.png" /><figcaption>Palette with Airflow package operators included</figcaption></figure><p>While not strictly required, you should also make sure that the version of the package download URL that you are using matches the version of the Apache Airflow package in your cluster. If they do not match, changes made to an operator between versions could cause an error during pipeline execution.</p><p>Like the existing catalog connector types, the new Airflow Provider Package Connector also facilitates sharing pipelines between Elyra deployments. For example, assume User A adds operators from archive<em> </em>apache_airflow-1.10.15-py2.py3-none-any.whl to their Elyra deployment and creates a pipeline using those operators. User B has their own Elyra deployment and configures a catalog to add operators from older archive apache_airflow-1.10.12-py2.py3-none-any.whl. In this situation, User B can still run pipelines that User A created, and vice versa, because the operators are internally identified using a set of descriptors that do not include the version number of the configured archive download URL. As mentioned above, operators may differ slightly between versions, and changes to certain node properties may be required in order to guarantee the same functionality in the shared pipeline.</p><blockquote>Note that the connector should already support Airflow version 2.x packages, but these have not been tested as Elyra does not yet support Airflow 2.x.</blockquote><h4><strong>Airflow Provider Package Catalog Connector</strong></h4><p>If an operator isn’t installed with Airflow by default, there is a huge selection of provider packages that very likely contain operators that implement the needed functionality. Provider packages are written and maintained by the Apache Airflow community and must be installed separately on the Airflow cluster. The apache-airflow-providers-amazon package and the apache-airflow-providers-google package are two examples of community-maintained provider packages that implement support for a variety of Amazon and Google-related tasks, respectively. A full list of provider packages can be found <a href="https://airflow.apache.org/docs/#providers-packages-docs-apache-airflow-providers-index-html">here</a>. Users can also write their own providers to extend core functionality as required.</p><p>The instructions for configuring an <a href="https://elyra.readthedocs.io/en/stable/user_guide/pipeline-components.html#apache-airflow-provider-package-catalog">Airflow provider package catalog</a> to make its operators available in Elyra are much the same as the instructions for configuring an Airflow package catalog. When adding a new catalog from the ‘Component Catalogs’ panel, select ‘New Apache Airflow provider package operator catalog’. The remaining instructions are the same, including the requirements for the form of the Provider package download URL: a .<em>whl</em> file accessible from an anonymous HTTP GET request. Provider packages are commonly available on PyPI. Ensure that you are selecting the best version for your Airflow cluster.</p><p>The screenshot below shows a palette with several custom components imported from the Slack provider package on PyPI.</p><figure><img alt="screenshot of Palette with Slack provider package operators included. On the far left, “component catalogs” with a search bar is shown with “airflow 1.10.15 core” and “Slack Provider Package”. The left hand palette shows packages and operators, while the primary pane has only a message on how to start a new pipeline" src="https://cdn-images-1.medium.com/max/1024/1*bPrJu0XiEqKq1dIgzyxMCQ.png" /><figcaption>Palette with Slack provider package operators included</figcaption></figure><blockquote>Again, keep in mind that the provider package connector has not been tested for Airflow 2.x provider packages as Elyra does not yet support Airflow 2.x. If you are interested in implementing support for Airflow 2.x, please considering contributing this feature or suggesting related improvements as part of Elyra’s <a href="https://github.com/elyra-ai/elyra/discussions/1672">‘Bring Your Own Runtime’ objective</a>.</blockquote><p>Now that the package operators have been added to the palette, there is just one last step to complete in order to successfully export and submit Airflow pipelines that include custom components.</p><h4>Configuring Elyra to Support Custom Airflow Components</h4><p>Elyra and its VPE simplifies the pipeline creation and submission process for Airflow by removing the need to manually write the code to define the DAG. However, in order to successfully render the DAG for a given pipeline, Elyra must be configured to include information on the fully qualified custom operator classes used in that pipeline. This configuration supports Elyra’s ability to correctly render the import statements for all operator nodes in a given DAG.</p><p>If you do not correctly configure an operator package name and try to export or submit a pipeline, Elyra will give you an error message similar to the following:</p><figure><img alt="screenshot of Elyra error reading “ Operator PapermillOperator of not PapermillOperator is not configured in the list of available operators. Please add the fully qualified package name for the PapermillOperator to the AirflowPipelineProcessor.available_airflow_operators configuration”" src="https://cdn-images-1.medium.com/max/1024/1*ktaw8IgHQBahXsn9j5SZuw.png" /><figcaption>The PapermillOperator has not been added to the configuration</figcaption></figure><p>As noted in the screenshot, the operators’ fully qualified package names must be added to the available_airflow_operators variable. This variable is a list value and is a <a href="https://traitlets.readthedocs.io/en/stable/config.html">configurable trait</a> in Elyra. To configure available_airflow_operators<em>,</em> first create a configuration file from the command line:</p><pre>$ jupyter elyra --generate-config</pre><p>Open the created file and find the PipelineProcessor(LoggingConfigurable) header. Add the following line under that header.</p><pre>c.AirflowPipelineProcessor.available_airflow_operators.extend([...])</pre><p>Replace the … with the fully qualified package string for each operator class as needed. For example, if you want to use the <em>SlackAPIPostOperator</em> from the Slack provider package and the <em>PapermillOperator</em> from the core package in your pipelines, your configuration will look like this:</p><pre>#------------------------------------------------------------------<br># PipelineProcessor(LoggingConfigurable) configuration<br>#------------------------------------------------------------------</pre><pre>c.AirflowPipelineProcessor.available_airflow_operators.extend(<br>    [<br>        &quot;airflow.providers.slack.operators.SlackAPIPostOperator&quot;,<br>        &quot;airflow.operators.papermill_operator.PapermillOperator&quot;<br>    ]<br>)</pre><p>There is no need to restart JupyterLab in order for these changes to be picked up. Pipeline export and submit will now succeed!</p><blockquote>The Elyra team is currently working on automating this configuration step for the Airflow package connectors covered here. This step will still be required when using other types of connector catalogs, such as URL and filesystem catalogs.</blockquote><h4><strong>Conclusion</strong></h4><p>Thank you for reading and for your interest in Elyra. As an open-source project, we welcome contributions and feedback of any kind, from bug reports to new features to improved documentation. Find details about how you can reach out with questions, comments, or suggestions in the <a href="https://elyra.readthedocs.io/en/stable/getting_started/getting-help.html">Getting help topic in the documentation</a>. We look forward to hearing from you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aae882f80c4a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-data-ai/getting-started-with-apache-airflow-operators-in-elyra-aae882f80c4a">Getting Started with Apache Airflow Operators in Elyra</a> was originally published in <a href="https://medium.com/ibm-data-ai">IBM Data Science in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>