ML Worker

Easily execute your model in your Python environment

What is ML Worker?

To leverage your Python environment with all the packages you've already installed, Giskard provides the ML Worker component.
  • It opens a secured connection between your working Python environment and the Giskard platform you've installed
  • It executes the model in your working Python environment (notebook, Python IDE, etc)
When Giskard is installed it comes with a default embedded ML Worker based on python 3.7. This default worker is only used by demo projects provided by Giskard.

Starting ML Worker

  1. 1.
    Install giskard python library in the desired code environment:
pip install giskard
In case of installation errors related to giskard library, it's sometimes a good idea to remove it with:
pip uninstall giskard
and re-installing again
2. Then start an ML worker:
giskard worker start
If ML Worker manages to connect to Giskard instance, you should see the following message in the worker logs: "Connected to Giskard server." By default, giskard worker start establishes a connection to the Giskard instance installed on localhost:40041.
If Giskard is not installed locally, please specify the IP address (and a port in case a custom port is used). For example, giskard worker start -h
The default port on which the Giskard server is listening for external ML Worker connections is 40051. Make sure that this port is open on the Giskard server machine.
To see all available arguments, add --help to the command.

Starting ML Worker as a daemon

To start ML Worker as a daemon and let it run in the background, add -d argument.
giskard worker start -d
When started from Jupyter notebook, ML Worker should be run as a daemon. Otherwise, it'll block further notebook execution, so the command to start it is:
!giskard worker start -d

Running multiple ML Workers

It's possible to start multiple ML Workers, for example, to connect them to different Giskard instances. It's not possible, however, to have multiple workers that use the same python interpreter to be connected to the same Giskard instance.
If multiple workers are connected to Giskard, the latest one will be used.

Stopping ML Worker

To stop a particular ML Worker that runs as a daemon stop command should be called with the same parameters that were used to start it.
For example, to stop a worker started with default arguments, it's enough to call
giskard worker stop
If a worker was started like
giskard worker start -h -p 1234 -d
then it can be stopped with
giskard worker stop -h -p 1234
To stop all ML Workers running on a given machine:
giskard worker stop -a

Having information about ML Worker in Giskard UI

Admin users can find information about an ML Worker that is currently active in Giskard on a Giskard settings page:


By default, ML Worker execution logs are located in $HOME/giskard-home/run/ml-worker.log.
You can access the logs by executing the following command in your notebook:
!tail -f $HOME/giskard-home/run/ml-worker.log