argparser.add_argument('--backend-swarm-url',help='Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)',default='http://localhost:2375')
argparser.add_argument('--backend-swarm-zk-path',help='Swarm/Docker optional ZooKeeper path for Swarm Znodes',default='/docker')
argparser.add_argument('--cookie-secret',help='secret used to encrypt cookies',default='changeme')
"""The base class that all backends should implement."""
def__init__(self,conf):
pass
definit(self,state):
"""Initializes the backend. In general this includes finding the current API endpoint and opening a connection to it, negotiate the API version, etc. Here backend-related threads can be started, too. This method will be called only once at Zoe startup."""
raiseNotImplementedError
defshutdown(self):
"""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."""
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
"""
raiseNotImplementedError
defterminate_service(self,service:Service)->None:
"""Terminate the container corresponding to a service."""
raiseNotImplementedError
defplatform_state(self)->ClusterStats:
"""Get the platform state. This method should fill-in a new ClusterStats object at each call, with fresh statistics on the available nodes and resource availability. This information will be used for taking scheduling decisions."""
"""Given a subset of services from an execution, tries to start them, return one of 'ok', 'requeue' for temporary failures and 'fatal' for fatal failures."""
"""Retrieves the state of the platform by querying the container backend. Platform state includes information on free/reserved resources for each node. This information is used for advanced scheduling."""