View Workload's Status
View Workload Status
You can view the current status of any workload.
The status will show whether it is running, stopped, staged, etc. as well as provide all information about the current configuration of the workload like the assets assigned, recommendation definitions, environment variables, etc.
You can only get limited information about the workload from the Kelvin UI.
If the Workload has a staged Workload waiting to be activated then you will be able to expand the row and see details abou the staged Workload.
You can read the full documentation here.
curl -X 'GET' \
'https://<url.kelvin.ai>/api/v4/workloads/list?workload_name=pcp-optimization-d1gdvz1gst7n&pagination_type=cursor&page_size=20&direction=asc&sort_by=name' \
-H 'Authorization: Bearer <Your Current Token>' \
-H 'accept: application/json-cursor'
You will get a response similar to this;
{
"pagination": {
"next_page": null,
"previous_page": null
},
"data": [
{
"name": "pcp-optimization-d1gdvz1gst7n",
"title": "pcp-optimization-d1gdvz1gst7n",
"enabled": true,
"acp_name": "beta-dev-01-cluster",
"cluster_name": "beta-dev-01-cluster",
"node_name": "beta-dev-01-cluster",
"app_name": "pcp-optimization",
"app_version": "1.0.05221921",
"created": "2024-05-22T18:27:27.70517Z",
"updated": "2024-06-13T14:13:18.985888Z",
"status": {
"state": "running",
"message": "Running",
"last_seen": "2024-06-14T04:57:52.520335503Z",
"warnings": null
},
"download_status": "pending",
"staged": null
}
]
}
from kelvin.api.client import Client
# Login
client = Client(config={"url": "https://<url.kelvin.ai>", "username": "<your_username>"})
client.login(password="<your_password>")
# Get Workload Details
response = client.workload.get_workload(workload_name="pcp-optimization-d1gdvz1gst7n")
print(response)
You will get a response similar to this;
"acp_name=""beta-dev-01-cluster""app_name=""pcp-optimization""app_version=""1.0.05221921""cluster_name=""beta-dev-01-cluster"created=datetime.datetime(2024,5,22,18,27,27,705170,
"tzinfo=datetime.timezone.utc) download_status=<WorkloadDownloadStatus.pending":"pending""> enabled=True instantly_apply=None name=""pcp-optimization-d1gdvz1gst7n""networking="[]
"node_name=""beta-dev-01-cluster""payload="{
"app":{
"kelvin":{
"assets":[
{
"metrics":{
"casing_pressure":{
"remote":true
},
"fluid_over_pump":{
"remote":true
},
"gas_flow_rate":{
"remote":true
},
"speed":{
"remote":true
},
"speed_sp":{
"remote":true
},
"temperature":{
"remote":true
},
"torque":{
"remote":true
},
"tubing_pressure":{
"remote":true
},
"water_flow_rate":{
"remote":true
}
},
"name":"pcp_18"
},
...
{
"metrics":{
"casing_pressure":{
"remote":true
},
"fluid_over_pump":{
"remote":true
},
"gas_flow_rate":{
"remote":true
},
"speed":{
"remote":true
},
"speed_sp":{
"remote":true
},
"temperature":{
"remote":true
},
"torque":{
"remote":true
},
"tubing_pressure":{
"remote":true
},
"water_flow_rate":{
"remote":true
}
},
"name":"pcp_02",
"parameters":{
"dd_rate_max":{
"value":0.55
},
"dd_rate_min":{
"value":0.12
}
}
}
],
"configuration":{
"recommendations":[
{
"description":"Water level increasing, higher pump speed will lead water level to return to optimal.",
"setpoint":{
"name":"speed_sp",
"variation_factor":0.1
},
"type":"speed_increase"
},
...
{
"description":"No action - monitoring",
"setpoint":"None",
"type":"no_action"
}
]
},
"inputs":[
{
"data_type":"number",
"name":"casing_pressure"
},
...
{
"data_type":"number",
"name":"temperature"
}
],
"language":{
"python":{
"entry_point":"app:App"
},
"type":"python"
},
"outputs":[
{
"control_change":true,
"data_type":"number",
"name":"speed_sp",
"storage":"node-and-cloud"
}
]
},
"type":"kelvin"
},
"info":{
"description":"This Kelvin SmartApp™ uses the values coming from the well control system such as flow rate, pressure, and motor speed, to optimize the speed of the PCP motor. As a byproduct we have a lower energy use by the equipment.",
"name":"pcp-optimization",
"title":"PCP Optimization",
"version":"1.0.05221921"
},
"spec_version":"4.12.0",
"system":{
"environment_vars":[
{
"name":"KELVIN_GW_MODE",
"value":"SOCKETS"
}
],
"ports":[
],
"privileged":false,
"volumes":[
]
}
}
pre_download=None
status=WorkloadStatus(last_seen=datetime.datetime(2024,6,14,4,28,38,527087,"tzinfo=datetime.timezone.utc)","message=""Running","state=<WorkloadStatus.running":"running"">","warnings=None) title=""pcp-optimization-d1gdvz1gst7n"updated=datetime.datetime(2024,6,13,14,13,18,985888,"tzinfo=datetime.timezone.utc) staged=None"

