A user-defined extension (UDx) is a component that expands OTCAD functionality—for example, new types of data analysis and the ability to parse and load new types of data.
This is the multi-page printable view of this section. Click here to print.
Overview of UDx
1 - Developing user-defined extensions (UDx)
The primary strengths of UDx are:
-
You can use them wherever you use internal functions.
-
They take full advantage of the distributed computing feature of the system. The extensions usually execute in parallel on each node in the cluster.
-
The complicated aspects of developing a distributed piece of analytic code are handled by the system. Your main programming task is to read in data, process it, and then write it out using the SDK APIs.
Fenced mode
Fenced mode runs the UDx code outside of the main system process. Fenced UDx crashes do not impact the core system process. There is a small performance impact when running UDx code in fenced mode. On average, using fenced mode adds about 10% more time to execution.
Fenced mode is currently available for all UDx with the exception of user-defined aggregates. All UDx run in fenced mode, since the Python runtimes cannot run directly within the system process. Using fenced mode does not affect the development of your UDx. Fenced mode is enabled by default for all UDx.
OTCAD does not support the unfenced mode.
Scalar functions (UDSFs)
A user-defined scalar function (UDSF) returns a single value for each row of data it reads. You can use a UDSF anywhere you can use a built-in database function. For more information about UDSF, see Scalar functions (UDSFs).
2 - UDx
OTCAD enables you to create, list, and delete custom UDx, so that you can integrate them with existing database tables. UDx allow you to reuse and share code that extends built-in functionality. Use UDx to perform specific tasks such as complex calculations, transformations, or custom data manipulations.
You can reuse a UDx several times. A function always returns a value explicitly by specifying an expression. It is a good choice to calculate and return a value. You can use UDFs to extend built-in functions or to encapsulate calculations that are standard for your organization. UDFs you create can be called in a way similar to built-in functions.
In the present OTCAD release, you write a UDF’s logic (it's handler) – in python.
About UDx
You can view and manage UDx. After logging in to OTCAD, the home page appears. Select the More options button and UDx. The User-defined extensions page appears with the Functions and UDx jobs tabs.
The Functions tab lists the functions that are available in the system. The following columns are displayed:
- Schema name - The name of the schema.
- Function name - The name of the function.
- Language - The language in which the function is developed. For e.g, Python.
- Library - The name of the library to which the UDx is associated.
- Created by - The user ID of the person who created the function.
- Actions - Option to delete the function.
The UDx jobs tab lists the UDx along with the status that are available in the system. The following columns are displayed:
- Library - The name of the library containing the UDx.
- Language - The language in which the library is developed. For e.g, Python.
- Functions - The number of functions associated with the UDx.
- Created by -The user ID of the person who created the library.
- Creation date - The date and time of creation of the library.
- Status - The present status of the UDx job.
- Details - Details about the UDx in the system.
Create a library
To create a library, do the following in the User-defined extensions page:
-
Select +Add new.
The Create a library page appears.
-
In the Library name field, enter the name of the library.
-
In the Schema list, choose the required schema.
-
In the Language list, choose the required language. For e.g, Python.
-
In the File name field, enter the name of the python file.
Note
Ensure that the class names are present in the python file and this file is available in the .zip file. -
Select Browse and choose the zip file that contains the python file you selected in the previous step.
Note
You can upload only .zip files. The maximum file size allowed is 300 MB. Ensure that the python file is available immediately in the root folder. For example, root/my_file.py. Uploaded files are quarantined for antivirus scanning. If no threats are found, OTCAD creates the function.Note
The uploading party is solely responsible for any code or content they submit. OpenText does not review or endorse uploads and assumes no liability for them. By uploading, users acknowledge and accept full responsibility for any consequences that may arise. -
In the Function area, for the Name field, enter the name of the function.
Note
Only UDSF functions are supported in this release.For more information about UDSF, see Scalar functions (UDSFs).
-
In the Function area, for the Define class field, enter the name of the class that is defined in the python file selected in step 5. For e.g, MultiplyAndSumFactory.
-
Click +Add new function to add another function. The newly added functions appear in the UDx jobs tab.
Note
You need to have super user privilege to create the library. -
Click Create. The library is created and displayed in the UDx Jobs tab of the User-defined extensions page.
Delete a function
You can delete functions that are no longer used or needed.
- In the User defined extensions page, select ⋮ in the Action column.
- Select Delete.
Note
Deleting a function removes it from the database. However, references to the function are not deleted. For example, SQL query. - In the Confirmation dialog, select Delete.