

def preload_image(self, image_name):

    def _preload(node, zone):
        split = node.split()
        if (len(split) > 0):
            node_name = split[0]
            if (node_name != 'kubernetes-master'):
                info_log(self.TAG, 'Preloading {0} onto {1}...'.format(image_name, node_name))
                docker_cmd = 'sudo gcloud docker pull {0}/{1}'.format(MainSettings.REGISTRY_NAME, image_name)
                cmd = ['gcloud', 'compute', 'ssh', node_name, '--zone', zone, '--command', '{}'.format(docker_cmd)]
                return subprocess.Popen(cmd)
        return None
    procs = self._nodes_command(_preload)
    info_log(self.TAG, 'Waiting for preloading to finish...')
    for proc in procs:
        if proc:
            proc.wait()
    info_log(self.TAG, 'Preloaded image {} onto all nodes'.format(image_name))
    return True

dataset/ETHPy150Open binder-project/binder/binder/cluster.py KubernetesManager.preload_image/original