def __init__(self, url, auth=None, workers=20, agent_id=None, queue_depth=Config.queue_depth()): if url.endswith("/schemas"): url = url[0:len(url)-len("/schemas")] self._url = url + "/subscribe" self._auth = auth self._workers = int(workers) self._children = [] self._agent_id = agent_id self._queue = Queue(queue_depth) self._ping_queue = Queue(queue_depth) type_manager.register_type(type_manager.PUBLISHER, Publisher(url + "/publish", auth))
def __init__(self, url, auth=None, workers=20, agent_id=None, queue_depth=Config.queue_depth()): if url.endswith("/schemas"): url = url[0:len(url) - len("/schemas")] self._url = url + "/subscribe" self._auth = auth self._workers = int(workers) self._children = [] self._agent_id = agent_id self._queue = Queue(queue_depth) self._ping_queue = Queue(queue_depth) type_manager.register_type(type_manager.PUBLISHER, Publisher(url + "/publish", auth))
def responses(): r = ResponseHolder() type_manager.register_type(type_manager.PUBLISHER, r) return r
def pull_image(image, progress): _DOCKER_POOL.pull_image(image, progress) def get_compute(): return _DOCKER_COMPUTE from .storage import DockerPool from .compute import DockerCompute from dstack import type_manager try: from docker import Client except: log.info('Disabling docker, docker-py not found') _ENABLED = False try: if _ENABLED: docker_client().info() except Exception, e: log.info('Disabling docker, could not contact docker') _ENABLED = False if _ENABLED and DockerConfig.docker_enabled(): _DOCKER_POOL = DockerPool() _DOCKER_COMPUTE = DockerCompute() type_manager.register_type(type_manager.STORAGE_DRIVER, _DOCKER_POOL) type_manager.register_type(type_manager.COMPUTE_DRIVER, _DOCKER_COMPUTE)
import marshaller import event_router import event_handlers from dstack.type_manager import register_type, MARSHALLER, ROUTER from dstack.type_manager import POST_REQUEST_HANDLER register_type(MARSHALLER, marshaller.Marshaller()) register_type(ROUTER, event_router.Router()) register_type(POST_REQUEST_HANDLER, event_handlers.PingHandler()) register_type(POST_REQUEST_HANDLER, event_handlers.ConfigUpdateHandler())
try: conn = libvirt.open() conn.close() except: log.info('Failed to get connection to libvirt') _ENABLED = True except: pass LIBVIRT_KIND = 'libvirt' if _ENABLED: from dstack.type_manager import register_type from dstack.type_manager import COMPUTE_DRIVER, STORAGE_DRIVER from .storage import LibvirtStorage from .compute import LibvirtCompute from .utils import * # NOQA register_type(COMPUTE_DRIVER, LibvirtCompute()) register_type(STORAGE_DRIVER, LibvirtStorage()) else: log.info('Disabling libvirt, libvirt-python not found') from qemu_img import QemuImg # NOQA def enabled(): return _ENABLED
def register_volume_driver(driver): register_type(_LIBVIRT_VOLUME_DRIVER, driver)
def register_pool_driver(driver): register_type(_LIBVIRT_POOL_DRIVER, driver)