AI Governance on Cloud Pak for Data with OpenPages custom workflow actions
Introduction
The emergence of artificial intelligence (AI) in recent years has brought about transformative technology with tremendous potential in various sectors and industries. As AI systems become more sophisticated and pervasive, ensuring responsible and ethical use through effective governance mechanisms has become significantly more crucial.
AI governance plays a pivotal role in addressing key challenges and concerns associated with AI, such as bias, fairness, transparency, and accountability. By implementing robust AI governance frameworks, organizations can mitigate risks, build trust, and ensure the responsible and ethical use of AI models in production environments.
Benefits
This post focuses on leveraging OpenPages custom workflow actions to initiate external processes, such as a CI/CD pipeline, to automate model deployment or decommissioning, or any other actions.
For some organizations, an ML Engineer would have to execute scripts or manually trigger the CI/CD pipeline for model deployment once it’s approved.
However, OpenPages enables the use of custom workflow actions to automatically initiate the CI/CD pipeline and deploy the model into production upon approval.
Nevertheless, the decision to automate these processes depends on organizational regulations and maturity. The benefits of automating these processes are as follows:
- Enhanced Productivity: By eliminating the need for ML Engineers to manually run scripts or trigger the CI/CD pipeline, the workflow becomes more efficient.
- Reduced Manual Errors: With automation in place, the chances of human errors occurring during script execution or CI/CD triggering are minimized, enhancing the overall reliability of the deployment process.
Sample AI Governance Workflow
Out of the box, OpenPages includes a variety of preconfigured workflows that effectively oversee the complete model development lifecycle. These workflows can be readily tailored to align with the specific needs of your organization.
For simplicity, I will demonstrate how custom workflow actions can be used in Step 8, to deploy a model.
This can be further extended to any actions such as,
- Triggering a CI/CD pipeline
- Running a script to perform other task
- Making a REST API call to trigger other services
- And many more actions …
OpenPages Custom Workflow Actions
Before you start creating custom actions, it is beneficial to read the following documentation,
- Creating custom actions for GRC workflows — https://www.ibm.com/docs/en/opw/9.0.0?topic=guide-creating-custom-actions-grc-workflows
- Object types — https://www.ibm.com/docs/en/opw/9.0.0?topic=guide-object-types
- Views — https://www.ibm.com/docs/en/opw/9.0.0?topic=guide-views
Note: The following OC commands references to the name of the OpenPages pod which may vary depending on how you name your OpenPages instance. I have named my OpenPages instance openpages-1
and the namespace is cpd
.
Two key points to note before creating OpenPages custom workflow actions.
1. Check the version of Java on which OpenPages is running. Your Java code for custom workflow actions needs to be compiled with the same Java version.
oc logs openpages-openpages-1-sts-0 -n cpd &> openpages-openpages-1-sts-0.log
Search for jdkSourceLevel. You should see something similar to the below output.
[7/5/23 5:39:30:921 UTC] 0000002d com.ibm.ws.jsp I JSPG8502I: The value of the JSP attribute jdkSourceLevel is "15".
2. Extract logs from the OpenPages pod for debugging purposes.
oc cp cpd/openpages-openpages-1-sts-0:/opt/ibm/OpenPages/aurora/logs/openpages-openpages-1-sts-0-aurora.log ./openpages-openpages-1-sts-0-aurora.log
Step 1: Download required JAR files
oc cp cpd/openpages-openpages-1-sts-0:/opt/ibm/wlp/usr/servers/defaultServer/apps/expanded/op-apps.ear/com.ibm.openpages.api.jar com.ibm.openpages.api.jar
Rember to download and include other JAR files that you will use in your code.
Step 2: Write custom action in Java
Below is a sample Java code that reads in parameters such as Project ID and Model ID from OpenPages linked to a Watson Studio project.
It then makes a REST API call with parameters to a Python function for further processing.
Step 3: Compile Java code and create a JAR file
The JDK version needs to support the command line switch — target 1.5
.
I have used the below Docker image in this example.
docker run --interactive --tty openjdk:8 bash
Run the following commands to compile and create a JAR file.
javac -cp lib/*:. com/randyphoa/TestCustomAction.java -source 1.5 -target 1.5
jar cf test-custom-action.jar com/randyphoa/TestCustomAction.class
The output from the JAR command should be a JAR file.
Step 4: Restart OpenPages application and upload the JAR file
Restart the OpenPages application by following the instructions from https://www.ibm.com/docs/en/opw/9.0.0?topic=SSFUEU_9.0.0/op_grc_admin/c_cp4d_start_stop.htm
Upload the JAR file from the previous step.
oc cp test-custom-action.jar cpd/openpages-openpages-1-sts-0:/opt/ibm/OpenPages/aurora/op-ext-lib/test-custom-action.jar
Step 5: Define custom action in workflow
Select the workflow to add a custom action.
Click on the action you want to add a custom action. In this example, click on the arrow from the Approval stage to the Approve stage.
Click on New Operation.
Select Custom action for Operation and give it a name. Specify the Class Name of your Java code.
Conclusion
In this post, I demonstrated how a custom workflow action is configured on OpenPages. This is a simplified example to demonstrate the concept of creating and configuring a custom action. In practice, technically any action can be done by configuring Object Types and Views and interacting with these parameters through Java custom actions.