Skip to content

Deploying Workloads

The following commands require a session

Check the Quickstart guide on how to login.

Managing Workloads

Deploy a Workload

The deployment operation is one of the most important in the entire process.
Deploying a workload will instantiate and run an App on a Node.
This can be done with the kelvin workload deploy command.

For more information on Apps and Nodes

Information on Nodes can be found on this page.
Information on Apps can be found on this page.

A workload is the relationship between an App and a Node. Workloads can be consulted with the kelvin workload list command.

  • This command takes the following **arguments**s:
    • --node-name, the node to which the app will be deployed.
    • --app-name, the app to be deployed on the node.
    • --workload-name, the name the workload must have on the deploy.
    • --app-config, the configuration to be applied on the workload.
  • And the following options:
    • --app-version, the version of the app to be deploy.
    • --workload-title, the title the workload must have on the deploy.
# kelvin workload deploy --node-name=<node-name> --app-name=<app-name:app-version> --app-config=<app_config>
kelvin workload deploy --node-name=node_one --app-name=qamm-app:0.0.1  --app-config=app.yaml

Success

[kelvin.sdk][2020-04-03 20:06:37][I] Creating workload..                                                                                                                                                                                                  
[kelvin.sdk][2020-04-03 20:06:37][I] Application configuration successfully loaded.                                                                                                                                                                     
[kelvin.sdk][2020-04-03 20:06:38][R]                                                                                                                                                                                                                      

            Workload "qamm-app-4cd5e9a0ab9dbd8f667dff2" successfully deployed.                                                                                                                                                                              

            To check the workload logs run the following command:                                                                                                                                                                                         
                    kelvin workload logs qamm-app-4cd5e9a0ab9dbd8f667dff2                                                                                                                                                                                   

            To update this workload run the following command:                                                                                                                                                                                            
                    kelvin workload update qamm-app-4cd5e9a0ab9dbd8f667dff2                                                                                                                                                                                                                                                                        

Undeploy a Workload

Much like the deploy operation, the undeploy command allows you to safely sever the association between the App and the Node. this can be achieved with the following command:

# kelvin workload undeploy <workload-name>
kelvin workload undeploy qamm-4cd5e9a0ab9dbd8f667dff2

Success

[kelvin.sdk][2020-12-30 13:30:22][W]                                                                                                                                                                                                                                                                                    

                This operation will remove the workload from the Node.                                                                                                                                                                                                                                                   
                All workload local data will be lost.                                                                                                                                                                                                                                                                   

            Are you sure?  [y/N] y                                                                                                                                                                                                                                                                                      

[kelvin.sdk][2020-12-30 13:30:30][I] Undeploying workload "qamm-4cd5e9a0ab9dbd8f667dff2"                                                                                                                                                                                                                                             
[kelvin.sdk][2020-12-30 13:30:32][I] Workload "qamm-4cd5e9a0ab9dbd8f667dff2" successfully undeployed        

Start a Workload

Once stopped, the workload can once again be started. This can be done with the following command:

# kelvin workload start <workload-name>
kelvin workload start qamm-4cd5e9a0ab9dbd8f667dff2.

Success

[kelvin.sdk][2020-04-03 20:09:14][I] Starting workload "qamm-4cd5e9a0ab9dbd8f667dff2"
[kelvin.sdk][2020-04-03 20:09:15][R] Workload "qamm-4cd5e9a0ab9dbd8f667dff2" successfully started

Stop a Workload

A workload can be stopped indefinitely it without being removed from the Node.

This can be done with the following command:

# kelvin workload stop <workload-name>
kelvin workload stop qamm-4cd5e9a0ab9dbd8f667dff2.

Success

[kelvin.sdk][2020-04-03 20:09:06][W]

        This operation will stop the workload from running in the Node.
        The persistent data will be kept intact.
        Are you sure?  [y/N] y

[kelvin.sdk][2020-04-03 20:09:14][I] Stopping workload "qamm-4cd5e9a0ab9dbd8f667dff2"
[kelvin.sdk][2020-04-03 20:09:15][R] Workload "qamm-4cd5e9a0ab9dbd8f667dff2" successfully stopped

Update a Workload

If a workload is already up and running, it can be updated to a new app version, title or even a new configuration. This can be achieved with the kelvin workload update command:

# kelvin workload update <workload-name> --app-version=<app-version> --workload-title<workload-title> --app-config=<app.yaml>
kelvin workload update myruningworkload-128ba8s8c8s0 --workload-title="this is the new title"

Success

[kelvin.sdk][2020-12-30 13:28:27][I] Updating workload "myruningworkload-128ba8s8c8s0"                                                                                                                                                                                                                                                
[kelvin.sdk][2020-12-30 13:28:29][I] Creating workload..                                                                                                                                                                                                                                                                
[kelvin.sdk][2020-12-30 13:28:34][I] Application configuration successfully loaded.                                                                                                                                                                                                                                     
[kelvin.sdk][2020-12-30 13:28:36][R]                                                                                                                                                                                                                                                                                    

                Workload "myruningworkload-128ba8s8c8s0" successfully deployed.                                                                                                                                                                                                                                                       

                To check the workload logs run the following command:                                                                                                                                                                                                                                                   
                        kelvin workload logs myruningworkload-128ba8s8c8s0                                                                                                                                                                                                                                                              

                To update this workload run the following command:                                                                                                                                                                                                                                                      
                        kelvin workload update myruningworkload-128ba8s8c8s0                                                                                                                                                                                                                                                            

[kelvin.sdk][2020-12-30 13:28:36][R] Workload "myruningworkload-128ba8s8c8s0" successfully updated     

Consulting Workloads

Listing Workloads

All workloads can be consulted with the kelvin workload list command:

  • This command takes the following options:
    • --node-name, filters the workloads by node.
    • --app-name, filters the workloads by app.
    • --app-version, filters the workloads by app version.

If no parameters are specified, the list command will attempt to retrieve all workloads.

# kelvin workload list --node-name=<node-name> --app-name=<app-name> --app-version=<app-version>
kelvin workload list

Success

[kelvin.sdk][2020-07-28 11:59:34][I] Retrieving workloads..                                                                                                                                                                                               
[kelvin.sdk][2020-07-28 11:59:35][I]                               
*************************** Workloads ***************************                                                                                                                                                                                         
+----------------------------------+--------------------------------------+--------------------+-----------------------------+---------------+-------------------------------+---------------------------------------------+                              
| Name                             | Title                                | Node Name          | App Name                    | App Version   | Workload Status               | Last Seen                                   |                              
|----------------------------------+--------------------------------------+--------------------+-----------------------------+---------------+-------------------------------+---------------------------------------------|                              
| analytics-eed4ded8a3a83a59652655 | analytics Workload                   | squad4-node1       | analytics                   | 2.0.4         | Running                       | 2020-07-28 10:23:29 +0000  (13 seconds ago) |                              
| even-odd-calcula-dccfc945e0dc95d | even-odd-calculator Workload         | tf-offline-mode-vm | even-odd-calculator         | 0.0.10        | Could not connect to Workload | No data yielded.                            |                              
| kelvin-dynacard--50b6c5bd28de1ce | kelvin-dynacard-forecasting Workload | squad4-node1       | kelvin-dynacard-forecasting | 1.0.4         | Running                       | 2020-07-28 10:23:29 +0000  (13 seconds ago) |                              
| modbus-serial-wl-b97291c03f31327 | modbus-serial-wl Workload            | squad4-node1       | modbus-serial-wl            | 2.0.0         | Running                       | 2020-07-28 10:23:29 +0000  (13 seconds ago) |                              
| plunger-simulato-1fa62596e637945 | plunger-simulator Workload           | squad3-node1       | plunger-simulator           | 0.0.2         | Running                       | 2020-07-28 10:23:34 +0000  (7 seconds ago)  |                              
| qamm-sdk-app-00-0f7c195aa7583da9 | qamm-sdk-app-00 Workload             | squad3-node1       | qamm-sdk-app-00             | 0.0.3         | Running                       | 2020-07-28 10:23:34 +0000  (7 seconds ago)  |                              
| qamm-sdk-app-00-614f8e66c2edbeaa | qamm-sdk-app-00 Workload             | squad3-node1       | qamm-sdk-app-00             | 0.0.4         | Failed                        | 2020-07-28 10:23:34 +0000  (7 seconds ago)  |                              
| qamm-sdk-app-00-6809d4b4700d2a09 | qamm-sdk-app-00 Workload             | squad3-node1       | qamm-sdk-app-00             | 0.0.4         | Running                       | 2020-07-28 10:23:34 +0000  (7 seconds ago)  |                              
| qamm-sdk-app-00-6e6f3b7f4e13a420 | qamm-sdk-app-00 Workload             | squad3-node1       | qamm-sdk-app-00             | 0.0.1         | Running                       | 2020-07-28 10:23:34 +0000  (7 seconds ago)  |                              
| qamm-testing-03                  | QAMM-TESTING-03                      | brito-vm           | qamm-sdk-app-00             | 0.0.1         | Could not connect to Workload | No data yielded.                            |                              
| qamm-testing-04                  | Brito App Workload                   | brito-vm           | brito-app                   | 1.0           | Could not connect to Workload | No data yielded.                            |                              
| random-number-ge-a0bb578014902c7 | random-number-generator Workload     | tf-offline-mode-vm | random-number-generator     | 0.0.3         | Could not connect to Workload | No data yielded.                            |                              
| tank-level-4792b18d5a618feacb176 | tank-level Workload                  | kvnode2            | tank-level                  | 0.2.1         | Running                       | 2020-07-28 10:23:09 +0000  (33 seconds ago) |                              
| workload-kskd-qamm-01            | qamm-sdk-app-00 Workload             | squad3-node1       | qamm-sdk-app-00             | 0.0.0         | Running                       | 2020-07-28 10:23:34 +0000  (7 seconds ago)  |                              
| workload-kskd-qamm-last          | qamm-sdk-app-00 Workload             | squad3-node1       | qamm-sdk-app-00             | 0.0.4         | Running                       | 2020-07-28 10:23:34 +0000  (7 seconds ago)  |                              
+----------------------------------+--------------------------------------+--------------------+-----------------------------+---------------+-------------------------------+---------------------------------------------+    

Searching Workloads

In addition to listing all workloads, you can search for specific workloads with the kelvin workload search command:

# kelvin workload search <query>
kelvin workload search qamm

Success

[kelvin.sdk][2020-07-28 18:51:47][I] Searching workloads that match "qamm"                                                                                                                                                                              
[kelvin.sdk][2020-07-28 18:51:48][R]                                                                                                                                                                                                                      
*************************** Workloads ***************************                                                                                                                                                                                         
+----------------------------------+--------------------------+-------------+-----------------+---------------+-------------------------------+---------------------------------------------+                                                             
| Name                             | Title                    | Node Name   | App Name        | App Version   | Workload Status               | Last Seen                                   |                                                             
|----------------------------------+--------------------------+-------------+-----------------+---------------+-------------------------------+---------------------------------------------|                                                             
| qamm-sdk-app-00-0e5a171f2de404f0 | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.3         | Stopped                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-sdk-app-00-0f7c195aa7583da9 | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.3         | Running                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-sdk-app-00-614f8e66c2edbeaa | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.4         | Failed                        | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-sdk-app-00-6809d4b4700d2a09 | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.4         | Running                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-sdk-app-00-6e6f3b7f4e13a420 | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.1         | Running                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-sdk-app-00-6fb0c94ec3aa2330 | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.0         | Stopped                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-sdk-app-00-a34a5dc3ad2397e4 | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.3         | Stopped                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-sdk-app-00-c62c2d0c57f8891c | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.1         | Stopped                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-sdk-app-00-eab6d0e09ce6bb8f | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.1         | Stopped                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| qamm-testing-03                  | QAMM-TESTING-03          | brito-vm    | qamm-sdk-app-00 | 0.0.1         | Could not connect to Workload | No data yielded.                            |                                                             
| qamm-testing-04                  | Brito App Workload       | brito-vm    | brito-app       | 1.0           | Could not connect to Workload | No data yielded.                            |                                                             
| qamm-workload-03                 | QAMM-WORKLOAD-03         | squad3-node1| qamm-sdk-app-00 | 0.0.3         | Stopped                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| workload-kskd-qamm-01            | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.0         | Running                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| workload-kskd-qamm-02            | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.1         | Stopped                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
| workload-kskd-qamm-last          | qamm-sdk-app-00 Workload | squad3-node1| qamm-sdk-app-00 | 0.0.4         | Running                       | 2020-07-28 10:26:08 +0000  (27 seconds ago) |                                                             
+----------------------------------+--------------------------+-------------+-----------------+---------------+-------------------------------+---------------------------------------------+       

Details of a Workload

You can inspect a specific workload, retrieving its central information with the kelvin workload show command.

This command will yield the workload's central configuration as well as its current status and metrics (if available).

# kelvin workload show <workload-name>
kelvin workload show qamm-testing-03

Success

[kelvin.sdk][2020-12-30 12:25:39][I] Retrieving workload info for "qamm-testing-03"                                                                                                                                                                                                                                                                                                                                                                                                                
[kelvin.sdk][2020-12-30 12:25:41][I]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
*************************** Workload Info ***************************                                                                                                                                                                                                                                                                                                                                                                                                                                               

  node_name: squad3-node1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
  app_name: qamm-sdk-app-demo-02                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  app_version: 2.0.0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  created: 2020-12-10 17:05:48.928373+00:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
  enabled: True                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  name: qamm-testing-03                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
  networking:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  payload:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
    app:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      docker:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
        build:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
          args:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
          context: .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
          dockerfile: Dockerfile                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
      type: docker                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
    info:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
      description: qammtesting - changed                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
      name: qamm-sdk-app-demo-02                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
      title: qamm-sdk-app-demo-02                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      version: 2.0.0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    spec_version: 1.0.0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
  title: qamm-sdk-app-demo-02 Workload                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
  updated: 2020-12-10 19:53:31.034615+00:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                         


*************************** Workload Status ***************************                                                                                                                                                                                                                                                                                                                                                                                                                                             

  name: qamm-testing-03                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
  status:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    last_seen: 2020-12-30 11:59:59.756893+00:00                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
    message: Running                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    state: running                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
    warnings:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       


*************************** Workload Metrics ***************************                                                                                                                                                                                                                                                                                                                                                                                                                                            

  Allocation:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
    CPU usage: 0.4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
    Memory usage: 268.4 MB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  CPU utilization:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
    Timestamp (date): 2020-12-30 12:25:41   (now)                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
    Value: 3.651889864802692e-05                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
  Memory usage:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
    Timestamp (date): 2020-12-30 12:25:41   (now)                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
    Value: 1.5 MB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  Network data:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
    Transmitted (Tx): 33.8 kB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
    Received (Rx): 369.6 kB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

Get logs from a Workload

The logs of a workload can be retrieved with the kelvin workload logs command. This command will retrieve the last batch of logs output by the workload.

  • This command takes the following options:
    • --tail-lines, the number of lines to display. 200 by default.
    • --output-file, the output file to write the logs into.
    • --follow, if specified, will attach to the on-going process and retrieve the logs constantly.
# kelvin workload logs <workload-name>
kelvin workload logs process-wl

Success

[kelvin.sdk][2020-12-30 12:44:28][I] Retrieving workload logs for "process-wl"                                                                                                                                                                                                                    
[kelvin.sdk][2020-12-30 12:44:30][I] 2020-12-30T12:42:36.56170931Z iPumpIntakePressure - 11.0                                                                                                                                                                                                                           
2020-12-30T12:42:36.561868369Z iBottomHolePressure - -5.0                                                                                                                                                                                                                                                               
2020-12-30T12:42:36.562009326Z iFluidHeightInCasing - 46.0                                                                                                                                                                                                                                                              
2020-12-30T12:42:36.562166432Z nowiGasProduction - 87.0                                                                                                                                                                                                                                                                 
2020-12-30T12:42:36.562438761Z nowiGrossProduction - 152.0                                                                                                                                                                                                                                                              
2020-12-30T12:42:36.562625154Z iNetProduction - 234.0