Live Drilling
  • Introduction
  • FAQ
  • what's new
    • Latest releases
      • Wells 5
      • LiveRig 5
      • LiveRig 4
      • WITSML Store
    • Operations in Time by Depth Chart
    • Unit Sets
      • Per-Asset Units
      • Unit Conversion
      • Dashboard Configuration
      • Force Follow Asset Units
    • Well casing shoe schematic
    • Wells correlation
    • FFT spectrum
    • Pressure Tests
      • Configuration
      • Automated Standard Pressure Tests
      • Manual Pressure Test
      • LOT/FIT
    • Rig State detection
    • BOP Schematic
      • BOP status register
    • Signal Processing
      • Moving Average
  • Data Flow
    • Introduction
    • Data Ingestion
    • Data Normalization
      • Clock Synchronization
      • Normalized events schema
      • Data indexes and enrichment
      • Unit conversion
      • Auto-Switch
  • Physical Models
    • Introduction
      • Structure of the functions
      • Validation
    • General Equations
      • Static Data Dependencies
      • Pipes Functions
    • Trajectory
      • Introduction
      • Static Data Dependencies
      • Pipes Functions
    • Hydraulic
      • Introduction
      • Static Data Dependencies
      • Pipes Functions
    • Torque and Drag
      • Introduction
      • Static Data Dependencies
      • Pipes Functions
    • Hole Cleaning
      • Introduction
      • Static Data Dependencies
      • Pipes Functions
    • Surge and Swab
      • Introduction
      • Static Data Dependencies
      • Pipes Functions
    • Thermal
      • Introduction
    • Volume Tracker
      • Introduction
      • Pipes Functions
  • Basic Features
    • Charts
      • Channels Charts
        • Temporal Channels Chart
        • Channel Value Chart
        • Depth Channels Chart
        • Data navigation
          • Span Control
      • Rig Allocation Gantt Chart
    • Unit sets
      • Configuration changes on unit sets
      • Depth unit changes
      • Personal units sets
    • Permission schema
    • Import/Export Well
    • Add-ons
  • Static Data
    • Assets
      • Assets Structure
    • Well
      • Introduction
      • Well Schema
      • Well Units
      • Regions, fields and countries
      • Well Design Overview
      • Objectives
    • Intervention
      • Introduction
      • Intervention Schema
      • Intervention Types
      • Scenarios
      • Runs
      • Completion and Abandonment
      • Drilling Section Schema
    • Rig
      • Introduction
      • Rig Schema
      • Physical models configuration
    • Pipes functions
    • REST API Examples
  • Administration
    • High Frequency Data
      • WITSML Null Values
      • Unit Management Tools
      • WITS Custom Mapping
    • Data Normalization
      • Data Management
        • Event Settings
        • Channels Management
      • Data normalization templates
      • Data normalization templates prioritization
      • Auto-Switch
    • Standard Identifiers
    • Static Data
      • Regions, fields and countries
      • Intervention Types
  • LiveRig Collector
    • Introduction
    • Getting Started
    • Connecting to Intelie Live
    • Security
    • Local data storage
    • Data transmission and recovery
    • Monitoring
    • Remote Control
      • APIs
        • /testSourceEndpoint
        • /storeConfiguration
        • /getFromStore
        • /backlog-sync
      • Sources
        • MQTT Topics
        • OPC Requests
        • WITSML Backlog Sync
        • WITSML Object Explorer
        • WITSML Requests
      • Properties
    • HA Deployment
    • Protocols
      • WITSML
      • WITS
      • OPC-DA
      • OPC-UA
      • MODBUS
      • MQTT
      • CSV
      • RAW
    • Protocol conversion
    • Configuration
      • liverig.properties
      • sources.xml
      • store.json
      • modbus.json
      • mqtt.json
      • Configuring an OPC-UA source
      • Multiple event types for WITSML sources
      • Certificate-based authentication for WITSML HTTPS sources
    • LiveRig Collector Appliance
    • Command line Interface (CLI)
  • LIVE EDGE
    • Collector Reader
  • Integrations
    • Introduction
    • WITSML Store
    • REST Output
    • REST Input
    • WellView
    • OpenWells
    • Python
  • DEVELOPER
    • Identified Curves
    • Hidden Units
  • DEPRECATED
    • WITSML Output
    • LiveRig 3.x / 2.x
      • 3.5.0
      • 3.4.0
      • 3.3.0
      • 3.2.0
      • 3.1.0
      • 3.0.0
      • 2.29.0
Powered by GitBook
On this page
  • Structured result
  • Multiple files persistence

Was this helpful?

  1. Integrations

Python

Live provides a console to execute python code via REST integration

PreviousOpenWellsNextIdentified Curves

Last updated 2 years ago

Was this helpful?

Dependencies required:

live-python-server-1.0.0+

plugin-py-1.1.0+

live-3.24.0+

The python server can run via Docker container image available on Intelie Marketplace with some code validation and common machine learning libraries pre installed:

  • Tensorflow/Keras

  • Numpy

  • Pandas

  • Scikit-Learn

  • Matplotlib

  • Pytorch

The integration does not support image rendering.

First install plugin-py and check that is valid at the admin of plugins:

Python plugin valid at the admin

Configure the server host name and port:

The option to open python console will be available at the header:

It is possible to execute code or drag and drop a python file into the console area:

The result will be shown for each print statement call invocation:

It is possible to clear, export, copy and paste files on the upper options:

Python Exceptions are captured and indicated in the response:

There are also a few modules, which are considered harmful, that are restricted by default:

If the option “persist as result event” is checked the result will be persisted as events on Live storage. It is possible to custom the event_type to be persisted or use default “py”:

By executing the query __src:'pysrc' __type:'py' on pipes console it is possible to see the persisted results:

It is possible to execute for example Tensorflow and Keras statements and save results as other event types:

By consuming the evets with __src:’pysrc’ it is possible to find result events with different event_types:

Reading data from Live storage

By executing run_query inside the console it is possible to retrieve data from events with Live incoming events:

from pipes.query import run_query

data = run_query(expression="=> random() * 200 as value every 2 seconds", span="last 10 seconds")

for i in data: print(data)

Or it is possible to retrieve data from an asset:

from pipes.query import run_query

data = run_query(expression="=> well('mywell') at the end", span="")

for i in data: print(data)

Structured result

For structured result as a object use send_event method specifying the object with fields as example below:

Multiple files persistence

Live provides the multiple files support for executing and saving python statements

plugin-py-1.3.0+ required

Python server host and port configuration
Python console
Python console results and expressions
Python console actions
Python console exceptions
Restricted modules
Event persitence
Events consumed
Tensorflow and Keras machine learning libraries code execution
Events consumed with different event types
Python console structured result
Python tree of files and actions