Integrated functionality of the AI Python Runtime.

AI Inference Server Function Manual

Portfolio
Industrial AI
Product
AI Inference Server
Software version
2.1.0
Language
en-US

Reporting

Python scripts can use the LogModule class (provided by AI Inference Server) to create log messages according to this example code:

from log_module import LogModule

log = LogModule()

...

log.info("info from EMBEDDED Python")

log.warning("warning from EMBEDDED Python")

log.warn("warn from EMBEDDED Python")

log.debug("debug from EMBEDDED Python")

log.error("error from EMBEDDED Python")

log.critical("critical from EMBEDDED Python")

...

The log messages are displayed on the user interface of the AI Inference Server.

Exception handling

The AI Inference Server is fully capable of processing user-defined exceptions from Python.

from log_module import LogModule

log = LogModule()

def process_input(...):

    ...

    raise ValueError('A user defined ValueError happened.')

   ...

from log_module import LogModule

log = LogModule()

def process_input(...):

    ...

    raise Exception('A user defined exeption thrown.')

   ...

When these exceptions occur, the event chain is transferred to the inference server user interface and the error message is displayed.

Note:

Exception handling is available in the entire Python script.

Persistent storage for pipelines

The Python scripts can create and process directories and files in the current working directory, but these are all gone after the pipeline is stopped.

It is also possible to store temporary data on the hard drive that persists after the pipeline is stopped or even after the edge device is rebooted. These created files and folders are available for all steps in the pipeline and remain until the pipeline is deleted.

All steps can access this pipeline store from the ./_pipeline_storage folder. Therefore, any file (folder) created in the ./_pipeline_storage folder will be placed in pipeline storage.

    filepath = './_pipeline_storage/sample.txt'

    f = open(filepath, 'w')

    f.write(”example”)

    f.close()

Restriction: The step that originally contains a file or folder named _pipeline_storage cannot use the pipeline storage.

See alsoPython wheels