Downloading streams flow code in a code archive package
Sometimes it’s useful to examine the code that gets generated from the streams flow that is designed on the streams flow canvas. Download the flow code in the following situations:
The streams flow has compile or runtime errors.
Version compatibility problems exist.
The streams flow has performance problems.
You need operators that are not available in the streams flow canvas. You can use the initial code that is generated for the streams flow, and then continue developing in IBM Streams Studio.
The code archive is a package that the streams flow generates and sends to the Streaming Analytics service to build and run the streams flow.
The code archive package contains the following components:
Uncompiled SPL code that generated the streams flow.
Toolkits, Python libraries, and scripts that are required to compile and run the streams flow.
You can download the code archive package from the Metrics or the Canvas page to your local disk. Then, you can compile the code, import it into your Streaming Analytics instance, and submit the job to the Streams Console in IBM Cloud.
Download and install the following software on your local disk:
Python, Version 3.6 or later.
To download the code archive log, follow these steps:
Download the code either in the Metrics page of the streams flow or in the Canvas toolbar. Note that the flow must be valid to perform a download.
a. To download the code in the Metrics page, click the Notifications icon to open the Notification taskbar. In the Notification taskbar, click the Download code archive icon .
b. To download the code in the Canvas page, click the Download code archive icon .
With either of of these actions, a compressed file is downloaded to your local disk. For example, the compressed file migt be
*.tar.gzfile, and then extract its contents to a
*.tarfile. In our example, the extacted file might be
*.tarfile to open it and extract its files to a local directory. In our example, the directory contains the following files:
You can see the SPL code in the file
Open a command prompt window in the environment where you installed Streaming Analytics, and then perform the following steps.
a. Go to the directory where the extracted
b. Type the command
make. This command compiles the SPL code file, and then generates a
*.sab(Streams Application Bundle) file in
Check the SPL code and make any needed changes. Then, run the
make command again to recompile the updated SPL file and create a new *.sab file.
You can deploy the *.sab file to the Streams Console in IBM Cloud, and then monitor your application.
Note: Neither the SPL code, nor the new *.sab file can be converted back into a streams flow.