Manage External Services
ZenML pipelines are fully aware of external, longer-lived services.
ZenML interacts with external systems (e.g. prediction services, monitoring systems, visualization services) with a so-called Service abstraction. The concrete implementation of this abstraction deals with functionality concerning the life-cycle management and tracking of an external service (e.g. process, container, Kubernetes deployment etc.).
One concrete example of a Service is the built-in LocalDaemonService, a service represented by a local daemon process. This extends the base service class with functionality concerning the life-cycle management and tracking of external services implemented as local daemon processes.
Services can be passed through steps like any other object, and used to interact with the external systems that they represent:
1
from zenml.steps import step
2
3
4
@step
5
def my_step(my_service: MyService) -> ...:
6
if not my_service.is_running:
7
my_service.start() # starts service
8
my_service.stop() # stops service
Copied!
You can see full examples of using services here:

Example services

One concrete example of a Service implementation is the TensorboardService. It enables visualizing TensorBoard logs easily by managing a local TensorBoard server.
1
from zenml.integrations.tensorflow.services.tensorboard_service import (
2
TensorboardService,
3
TensorboardServiceConfig
4
)
5
6
service = TensorboardService(
7
TensorboardServiceConfig(
8
logdir=logdir,
9
)
10
)
11
12
# start the service
13
service.start(timeout=20)
14
15
# stop the service
16
service.stop()
Copied!
This couples nicely with the TensorboardVisualizer to visualize Tensorboard logs.
Other examples of Services can be found in the continuous training and deployment guide.
Export as PDF
Copy link
Edit on GitHub