Ejemplo n.º 1
0
def get_optimal_docker_host():
    """
    Returns the optimal docker host to build image.
    """
    scheduler = DockerSchedulerFactory.get_scheduler()
    docker_host = scheduler.get_optimal_docker_host()
    return docker_host
Ejemplo n.º 2
0
def get_optimal_docker_host():
    """
    Returns the optimal docker host to build image.
    """
    scheduler = DockerSchedulerFactory.get_scheduler()
    docker_host = scheduler.get_optimal_docker_host()
    return docker_host
Ejemplo n.º 3
0
 def _get_build_docker_host(self):
     """
     Returns the optimal docker host to build image.
     """
     scheduler = DockerSchedulerFactory.get_scheduler()
     docker_host = scheduler.get_optimal_docker_host()
     logger.debug("select the optimal docher host %s" % docker_host)
     return docker_host
Ejemplo n.º 4
0
def list_hosts(request, *args, **kwargs):
    if not (request.user and request.user.is_staff):
        raise PermissionDenied()

    scheduler = DockerSchedulerFactory.get_scheduler()
    hosts = scheduler.get_docker_hosts()

    return JsonResponse(hosts, safe=False)
Ejemplo n.º 5
0
def list_hosts(request, *args, **kwargs):
    if not (request.user and request.user.is_staff):
        raise PermissionDenied()

    scheduler = DockerSchedulerFactory.get_scheduler()
    hosts = scheduler.get_docker_hosts()

    return JsonResponse(hosts, safe=False)
Ejemplo n.º 6
0
 def _get_build_docker_host(self):
     """
     Returns the optimal docker host to build image.
     """
     scheduler = DockerSchedulerFactory.get_scheduler()
     docker_host = scheduler.get_optimal_docker_host()
     logger.debug("select the optimal docher host %s" % docker_host)
     return docker_host
Ejemplo n.º 7
0
 def _delete_image_instance_on_all_hosts(self):
     """
     Delete image instance on all hosts.
     """
     image_name = self._get_image_name()
     image_version = self.image.version
     scheduler = DockerSchedulerFactory.get_scheduler()
     hosts = scheduler.get_docker_hosts()
     for host in hosts:
         base_url = self._get_docker_host_base_url(host)
         self._delete_image_on_docker_host(base_url, image_name,
             image_version)
Ejemplo n.º 8
0
 def _delete_image_instance_on_all_hosts(self):
     """
     Delete image instance on all hosts.
     """
     image_name = self._get_image_name()
     image_version = self.image.version
     scheduler = DockerSchedulerFactory.get_scheduler()
     hosts = scheduler.get_docker_hosts()
     for host in hosts:
         base_url = self._get_docker_host_base_url(host)
         self._delete_image_on_docker_host(base_url, image_name,
                                           image_version)
Ejemplo n.º 9
0
 def test_scheduler_factory(self):
     scheduler1 = DockerSchedulerFactory.get_scheduler()
     scheduler2 = DockerSchedulerFactory.get_scheduler()
     self.assertEqual(scheduler1, scheduler2)
Ejemplo n.º 10
0
 def test_scheduler_factory(self):
     scheduler1 = DockerSchedulerFactory.get_scheduler()
     scheduler2 = DockerSchedulerFactory.get_scheduler()
     self.assertEqual(scheduler1, scheduler2)