Resuable Rubipython/RubiR Code
Resuable RubiPython/RubiR Code
You can publish the RubiPython/RubiR code from a workbook/Pipeline and reuse it in another workbook or pipeline of same project. This feature is similar to publishing models in RubiStudio.
Note that same functionality is applicable to RubiPython and RubiR. So Refer RubiR wherever RubiPython is used in below document.
To publish RubiPython code, follow the steps given below.
- Write the RubiPython code as required. Refer to Writing Custom Code using Rubiython.
- Run the RubiPython node.
- After the node is successfully executed, select the node, click the vertical ellipsis (), and click Publish code.

After the code is successfully published, a confirmation message is displayed. This code is listed under Code Snippets on the Rubiscape Home page.
Notes: | - The published code is also available under Reusable Codes in Pro Code under rubistudio in the Task Pane of a workbook/Pipeline.
- The name of the published RubiR node should be unique. If a RubiR code with the same name already exists, Rubiscape gives an error.
|
Reusing RubiPython Code
The published RubiPython code is available for reuse in workbooks and pipelines in the same project of the workspace.
To reuse a published code, follow the steps given below.
- Open the workbook/Pipeline or create a workbook/Pipeline. Refer to Opening a Workbook and Creating a Workbook.
Click Reusable Codes under Code Fusion in rubistudio in the Task Pane.
The available reusable codes are displayed as shown in the figure below.
- Double-click or drag-and-drop the node on the workbook canvas.
- To run the code, select the node, click the vertical ellipsis ( ), and click Run.

Edit/Modify the Resuable Code:
The published code can be modified by edit option.
You can hover on the option below Reusable Code >> Click Edit Icon >> Code editor is displayed >> Modify and save code
Note that, this will consider the latest updated code for the newly taken Resuable Code Task. Earlier task code will remain unchanged.
Notes:
- The publish code is published with same name of task of RubiPython.
- The different RubiPython codes published with same name of tasks under same project will overwrite the earlier code.
- The RubiPython code is reusable at the project level in any of the entities- Workbook/Pipelines.
- Import export of project will carry forward your published code as well.
- You need to run the task first before publishing code.
- The same task can be re-published multiple times. Latest published code will get considered when you use the Resuable Code.
Related Articles
RubiR
RubiR is a feature within Code Fusion on the Rubiscape platform to write your code in the R programming language for building models. You can use RubiR as an independent node or connect it to your Reader node (dataset) or other algorithm nodes. ...
RubiR
RubiR is a feature within Code Fusion on the Rubiscape platform to write your code in the R programming language for building models. You can use RubiR as an independent node or connect it to your Reader node (dataset) or other algorithm nodes. This ...
RubiPython
Writing Custom Code using RubiPython Rubipython Task is available in Pro Code in TaskPane options of Workbook and Pipeline. Below mentioned functionality is available in Workbook as well as Pipeline. To write your custom code using RubiPython, follow ...
RubiPython
Writing Custom Code using RubiPython To write your custom code using RubiPython, follow the steps given below. Create your algorithm flow. Refer to Building Algorithm Flow in a Workbook Canvas. Drag and drop RubiPython on your workbook canvas. Notes: ...
Custom Functions in RubiPython
Reading Data from File A sample Python code to read data from file is shown in the image below. The table below explains the above code snippet. Line of Code Result getReaderData(“datasetName”,“subdatasetName”) This custom function checks the type of ...