Skip to main content
Version: Release 23.3

Digital.ai Release Integration Python SDK Overview

Digital.ai Release Integration Python SDK is a set of tools that Developers can use to build container-based plugins. With Digital.ai Release 23.1, we are bringing in a new integration SDK experience with which you can run tasks as containers, using any language or third-party libraries.

Important: The container-based task functionality is not compatible with DB2.

Digital.ai Release SDK Project

The Digital.ai Release Python SDK (digitalai-release-sdk 23.3.0) is available in the PyPI repository.

The Digital.ai Release Integration Python SDK template project serves as a template for developing a Python-based container plugin.

Key Concepts about Python SDK

The BaseTask is an abstract class in the SDK that acts as a blueprint for defining tasks. It contains several methods and attributes that can be utilized by subclasses of the BaseTask class. To create a custom task, you need to create a new class that extends the BaseTask abstract class and implement the task logic in the subclass.

The SDK will execute the task by calling the execute() method in the subclass. The execute() method contains the task logic, and it can be customized to perform any necessary operations. In the given tutorial, The Hello class is an example of a subclass that extends the BaseTask abstract class. It handles the properties for the input and output values for the task and implements the execute() method to get the value of the yourName field from the self.input_properties dictionary. Then, creates a greeting string using the f-string notation that includes the name provided in the input. Finally, sets the greeting output property to the greeting string using the set_output_property method.

The execute_task() method in the BaseTask abstract class is responsible for executing the task. It calls the execute() method and handles any exceptions that may occur during task execution.

The set_exit_code() and set_error_message() methods are used to set the exit code and error message for the task, respectively.

The SDK also provides the following methods and attributes that can be used to interact with the task execution environment:

  • The add_comment() method is used to add a comment to the task output.
  • The set_status_line() method is used to set the status line for the task.
  • The get_output_properties() method returns a dictionary containing the output properties for the task.
  • The abort() method is used to signal to the SDK that the task execution should be aborted. When abort() method is called, it sets the exit code to 1 and immediately exits the task process, causing the task to be marked as failed.

Overall, the SDK provides a powerful set of tools for creating container-based tasks. You can use the BaseTask abstract class as a starting point to define your custom tasks and take advantage of other methods and attributes to interact with the task execution environment.

Methods and Attributes

The BaseTask abstract class contains the following methods and attributes:

MethodTypeDescription
execute(self)NoneIt is an abstract method that must be implemented by the subclasses of BaseTask, and it represents the main logic of the task.
abort(self)NoneSets the task's exit code to 1 and exits the program with a status code of 1.
set_exit_code(self, value)NoneSets the exit code of the task's OutputContext object.
set_error_message(self, value)NoneSets the error message of the task's OutputContext object.
get_output_context(self)OutputContextReturns the OutputContext object associated with the task.
get_output_properties(self)Dict [String, Any]Returns the output properties of the task.
get_input_properties(self)Dict [String, Any]Returns the input properties of the task.
add_comment(self, comment: str)NoneAdds a comment to the task that will be visible in the UI.
set_status_line(self, status_line: str)NoneSet the status line of the task. This shows live updates on the UI.
add_reporting_record(self, reporting_record: Any)NoneAdds a reporting record to the OutputContext. The reporting records are used in the Audit Report.
set_output_property(self, name: str, value: Any)NoneSets the name and value of an output property of the task.
get_release_server_url(self)StringReturns the Release server URL of the associated task.
get_task_user(self)AutomatedTaskAsUserContextReturns the details of the user who executes the task.
get_default_api_client(self)ApiClientReturns an ApiClient object with default configuration based on the task.
get_release_id(self)StringReturns the Release ID of the task.
get_task_id(self)StringReturns the Task ID of the task.
input_propertiesDict [String, Any]It is the instance variable that contains the input properties for this task.