Debug algorithm

Introduction#

Hkube enable debugging algorithm on your local IDE as part of a pipeline executed on the cluster

Use Cases#

After executing the following job you suspect that the "yellow" node does not calculate its output properly and you wish to debug it in your local IDE

simpleDebug.png

How To#

HKUBE has four options for debug algorithm:

  • Debug Pipeline - execute the pipeline from start
    • In the pipeline descriptor change the node type from "algorithm" to "debug"
  • Debug from cache , debug specific node and while getting the data of the predecessors from caching of the previous run
    • In the dashboard open the relevant job select the algorithm you wish to debug click thedebug-icon.png icon
  • Debug algorithm (without pipeline)
    • Select the algorithm from the algorithm list and click thedebug-icon.png icon
  • Debug Override - execute the pipeline from start
    • Run the pipeline
    • To the options object add "debugOverride"
    • The value is an array with the nodes name you wish to debug i.e. "debugOverride":["yellow"]

Obtaining the debugging URL

TBD

On your IDE#

In order to debug your algorithm locally, install the "HKUBE wrapper" package

  • Python: pip install hkube-python-wrapper
  • nodeJS: npm i @hkube/nodejs-wrapper

After installing the "HKUBE wrapper" package add the following code to your project and start debugging :

Python:#

from hkube_python_wrapper import Algorunner
import algorithm.main as algorithm #the path of you "start" function

def main():
        print("starting algorithm runner")
        Algorunner.Debug("<the debugging URL>",algorithm.start)

if __name__ == "__main__":
    main()

NodeJS#

const NodejsWrapper = require('@hkube/nodejs-wrapper');
const alg = require("./hkubeApiImage") //the path of you "start" function
const main = async () => {
    NodejsWrapper.debug("<the debugging URL>",alg)
}

main()

Java#

Setup a run debug java configuration

run configuraion.jpg

  • Main class
  • Runtime ClassPath
    • io.hkube:wrapper:2.0-SNAPSHOT and its dependencies.
    • The written algorithm module. image.png When running the algorithm locally you need to set 2 environment variables:
NameDescription
ALGORITHM_ENTRY_POINTThe name of the class you wrote implementing IAlgorithm.
WORKER_SOCKET_URLpath obtained from a the debug algorithm defined on hkube deployment. e.g. ws://playground.hkube.io/hkube/debug/something

Instead of setting these environment variables, you can also add a config.properties file to the running classpath root directory and set these environment variable names as keys.

            WORKER_SOCKET_URL=ws://playground.hkube.io/hkube/debug/something
            ALGORITHM_ENTRY_POINT=Algorithm
  • Program argument 'debug'

To avoid the program attempting to load the algorithm from a jar, 'debug' should be given as a program argument.

Next →Tensorboard integration