Commit 90ceaee6 authored by Daniele Venzano's avatar Daniele Venzano

Update backend documentation

parent edeeff89
......@@ -23,12 +23,3 @@ Whenever Zoe needs to access the container backend it will create a new instance
.. autoclass:: zoe_master.backends.base.BaseBackend
:members:
Obligations for backends
------------------------
When a backend creates a container it must:
1. add all variables from ``zoe_master.backends.common.gen_environment(service, execution)`` to the environment of the container
2. add all volumes from ``zoe_master.backends.common.gen_volumes(service, execution)`` to the environment of the container
3. run the /zoe.sh script as the container entrypoint, passing any command specified in the application description as one or more arguments
......@@ -15,10 +15,9 @@
"""The base class that all backends should implement."""
from typing import Dict
from zoe_lib.state import Execution, Service
from zoe_master.stats import ClusterStats
from zoe_master.backends.service_instance import ServiceInstance
class BaseBackend:
......@@ -34,8 +33,17 @@ class BaseBackend:
"""Performs a clean shutdown of the resources used by Swarm backend. Any threads that where started in the init() method should be terminated here. This method will be called when Zoe shuts down."""
raise NotImplementedError
def spawn_service(self, execution: Execution, service: Service):
"""Create a container for a service."""
def spawn_service(self, service_instance: ServiceInstance):
"""Create a container for a service.
The backend translates all the configuration parameters given in the ServiceInstance object into backend-specific container options and starts the container.
This function should either:
* raise ``ZoeStartExecutionRetryException`` in case a temporary error is generated
* raise ``ZoeStartExecutionFatalException`` in case a fatal error is generated
* return a backend-specific ID that will be used later by Zoe to interact with the running container
"""
raise NotImplementedError
def terminate_service(self, service: Service) -> None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment