Ejemplo n.º 1
0
def write_exec_specs(**kwargs):
    """
    This function genetares the deployment description yaml for execution profiler
     
    In this case, call argument should be:
    
      -   name: {name}
      -   app: {label}
      -   kubernetes.io/hostname: {host}
      -   image: {image}
      -   SSH Port: {ssh_port}
      -   Mongo Port: {mongo_port}
      -   Flask Port: {flask_port}
      -   NODE_NAME: {node_name}
      -   HOME_NODE: {home_node_ip}

    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """
    jupiter_config.set_globals()

    specific_yaml = template_worker.format(
        ssh_port=jupiter_config.SSH_DOCKER,
        flask_port=jupiter_config.FLASK_DOCKER,
        mongo_port=jupiter_config.MONGO_DOCKER,
        **kwargs)
    dep = yaml.load(specific_yaml)
    return dep
Ejemplo n.º 2
0
def teardown_system(app_name):
    """Automatically tear down the whole system
    
    Args:
        app_name (str): Application name
    """
    jupiter_config.set_globals()

    static_mapping = jupiter_config.STATIC_MAPPING
    pricing = jupiter_config.PRICING
    scheduler = jupiter_config.SCHEDULER
    """
        Tear down all current deployments
    """

    if pricing == 0:
        print('Tear down all current Non-pricing CIRCE deployments')
        delete_all_circe(app_name)
    else:
        print('Tear down all current Pricing CIRCE deployments')
        delete_all_pricing_circe(app_name)
    if scheduler == 0 or scheduler == 3:  # HEFT
        print('Tear down all current HEFT deployments')
        delete_all_heft(app_name)
    else:  # WAVE
        print('Tear down all current WAVE deployments')
        delete_all_waves(app_name)
Ejemplo n.º 3
0
def add_ports(dep, app_specific_flag, *args):
    """Add information of ports for the application
  
  Args:
      dep (str): deployment service description
      app_specific_flag (boolean) : flag to add app specific ports
      args (list): List of app independent ports required by circe
  
  Returns:
      str: deployment service description with added port information for the application
  """
    jupiter_config.set_globals()

    INI_PATH = jupiter_config.APP_PATH + 'app_config.ini'
    config = configparser.ConfigParser()
    config.read(INI_PATH)

    dep['spec']['template']['spec']['containers'][0]['ports'] = []
    a = dep['spec']['template']['spec']['containers'][0]['ports']
    for i in args:
        a.append({'containerPort': int(i)})

    # Add app specific ports
    if app_specific_flag == 1:
        for i in config['DOCKER_PORT']:
            a.append({'containerPort': int(config['DOCKER_PORT'][i])})

    return dep
Ejemplo n.º 4
0
def write_heft_specs(**kwargs):
    """
    This function genetares the deployment service description yaml for HEFT
    In this case, call argument should be:
    
      -   app: {name}
      -   kubernetes.io/hostname: {host}
      -   image: {image}
      -   app: {label}
      -   flask Port: {flask_port}
      -   PROFILERS: {profiler_ips}
      -   NODE_NAMES: {node_names}
      -   EXECUTION_HOME_IP: {execution_home_ip}
      -   HOME_IP: {home_ip}
    
    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """
    jupiter_config.set_globals()

    specific_yaml = template.format(flask_port=jupiter_config.FLASK_DOCKER,
                                    **kwargs)

    dep = yaml.load(specific_yaml)
    return dep
Ejemplo n.º 5
0
def prepare_global_info():
    """Read configuration information from ``app_config.ini``
    
    Returns:
        - list: port_list_home - The list of ports to be exposed in the exec home dockers
        - list: port_list_worker - The list of ports to be exposed in the exec worker dockers
    """
    jupiter_config.set_globals()

    INI_PATH = jupiter_config.APP_PATH + 'app_config.ini'
    config = configparser.ConfigParser()
    config.read(INI_PATH)

    sys.path.append(jupiter_config.EXEC_PROFILER_PATH)

    port_list_home = []
    port_list_home.append(jupiter_config.SSH_DOCKER)
    port_list_home.append(jupiter_config.MONGO_DOCKER)
    port_list_home.append(jupiter_config.FLASK_DOCKER)
    for key in config["DOCKER_PORT"]:
        print(config["DOCKER_PORT"][key])
        port_list_home.append(config["DOCKER_PORT"][key])
    print('The list of ports to be exposed in the exec home dockers are ',
          " ".join(port_list_home))

    port_list_worker = []
    port_list_worker.append(jupiter_config.SSH_DOCKER)
    port_list_worker.append(jupiter_config.MONGO_DOCKER)
    port_list_worker.append(jupiter_config.FLASK_DOCKER)
    print('The list of ports to be exposed in the exec worker dockers are ',
          " ".join(port_list_worker))

    return port_list_home, port_list_worker
Ejemplo n.º 6
0
def write_profiler_specs(**kwargs):
    """
    This function genetares the description yaml for network profiler
     
    In this case, call argument should be:
    
      -   name: {name}
      -   app: {label}
      -   emptyDir: {dir}
      -   kubernetes.io/hostname: {host}
      -   image: {image}
      -   SSH Port: {ssh_port}
      -   Flask Port: {flask_port}
      -   Mongo Port: {mongo_port}
      -   ALL_NODES: {all_node}
      -   ALL_NODES_IPS: {all_node_ips}
      -   SELF_NAME: {name}
      -   SELF_IP: {serv_ip}
    
    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """
    jupiter_config.set_globals()

    specific_yaml = template.format(ssh_port=jupiter_config.SSH_DOCKER,
                                    flask_port=jupiter_config.FLASK_DOCKER,
                                    mongo_port=jupiter_config.MONGO_DOCKER,
                                    **kwargs)
    dep = yaml.load(specific_yaml)
    return dep
Ejemplo n.º 7
0
def main():
    """ 
        Deploy num_dags of the application specified by app_name
    """
    
    jupiter_config.set_globals()
    app_name = jupiter_config.app_option
    circe_port = int(jupiter_config.FLASK_CIRCE)
    
    
    num_samples = 2
    num_runs = 1
    num_dags_list = [1]
    #num_dags_list = [1,2,4,6,8,10]
    for num_dags in num_dags_list:
        temp = app_name
        print(num_dags)
        jupiter_config.set_globals()
        port_list = []
        app_list = []
        for num in range(1,num_dags+1):
            port =  circe_port + num-1
            cur_app = temp+str(num)
            port_list.append(port)
            app_list.append(cur_app)     
        print(port_list)
        print(app_list)
       
        for idx,appname in enumerate(app_list):
            print(appname)
            _thread.start_new_thread(deploy_app_jupiter, (app_name,appname,port_list[idx],num_runs,num_samples))
    app.run(host='0.0.0.0')
Ejemplo n.º 8
0
def build_push_wave():
    """Build WAVE home and worker image from Docker files and push them to the Dockerhub.
    """
    jupiter_config.set_globals()

    os.system("cp " + jupiter_config.APP_PATH + "configuration.txt " +
              jupiter_config.WAVE_PATH + "DAG.txt")

    os.system("cp " + jupiter_config.APP_PATH + "input_node.txt " +
              jupiter_config.WAVE_PATH + "input_node.txt")

    os.system("cp " + jupiter_config.HERE + "jupiter_config.ini " +
              jupiter_config.WAVE_PATH + "jupiter_config.ini")

    os.chdir(jupiter_config.WAVE_PATH)

    os.system(
        "sudo docker build --build-arg port_expose=%s -f home.Dockerfile . -t %s"
        % (jupiter_config.FLASK_DOCKER, jupiter_config.WAVE_HOME_IMAGE))
    os.system("sudo docker push " + jupiter_config.WAVE_HOME_IMAGE)

    os.system(
        "sudo docker build --build-arg port_expose=%s -f worker.Dockerfile . -t %s"
        % (jupiter_config.FLASK_DOCKER, jupiter_config.WAVE_WORKER_IMAGE))
    os.system("sudo docker push " + jupiter_config.WAVE_WORKER_IMAGE)

    os.system("rm DAG.txt")
    os.system("rm input_node.txt")
    os.system("rm jupiter_config.ini")
Ejemplo n.º 9
0
def write_circe_home_specs(**kwargs):
    """
    This function genetares the description yaml for CIRCE
     
    In this case, call argument should be:
    
      -   image: {image}
      -   SSH Port: {ssh_port}
      -   Flask Port: {flask_port}
      -   CHILD_NODES_IPS: {child_ips}
      -   kubernetes.io/hostname: {host}
    
    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """

    jupiter_config.set_globals()

    INI_PATH = jupiter_config.APP_PATH + 'app_config.ini'
    config = configparser.ConfigParser()
    config.read(INI_PATH)

    specific_yaml = template_home.format(
        ssh_port=jupiter_config.SSH_DOCKER,
        flask_port=jupiter_config.FLASK_DOCKER,
        mongo_port=jupiter_config.MONGO_DOCKER,
        **kwargs)

    dep = yaml.load(specific_yaml)
    return dep
def add_app_specific_ports(dep):
    """Add information of specific ports for the application
  
  Args:
      dep (str): deployment service description
  
  Returns:
      str: deployment service description with added specific port information for the application
  """

    jupiter_config.set_globals()

    INI_PATH = jupiter_config.APP_PATH + 'app_config.ini'
    config = configparser.ConfigParser()
    config.read(INI_PATH)

    a = dep['spec']['ports']

    for i in config['DOCKER_PORT']:
        dic = {}
        dic['name'] = i
        dic['port'] = int(config['SVC_PORT'][i])
        dic['targetPort'] = int(config['DOCKER_PORT'][i])
        a.append(dic)

    return dep
Ejemplo n.º 11
0
def write_wave_specs(**kwargs):
    """
    This function genetares the description yaml for WAVE
     
    In this case, call argument should be:
    
      -   name: {name}
      -   app: {label}
      -   kubernetes.io/hostname: {host}
      -   image: {image}
      -   Flask Port: {flask_port}
      -   ALL_NODES: {all_node}
      -   ALL_NODES_IPS: {all_node_ips}
      -   SELF_NAME: {name}
      -   SELF_IP: {serv_ip}
      -   HOME_IP: {home_ip}
      -   HOME_NAME: {home_name}
      -   PROFILER: {profiler_ip}
    
    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """
    jupiter_config.set_globals()

    specific_yaml = template.format(flask_port=jupiter_config.FLASK_DOCKER,
                                    **kwargs)
    dep = yaml.load(specific_yaml)
    return dep
Ejemplo n.º 12
0
def get_service_circe(dag, app_name):
    jupiter_config.set_globals()
    config.load_kube_config(config_file=jupiter_config.KUBECONFIG_PATH)
    namespace = jupiter_config.DEPLOYMENT_NAMESPACE
    api = client.CoreV1Api()

    service_ips = {}
    home_name = app_name + "-home"
    try:
        resp = api.read_namespaced_service(home_name, namespace)
        service_ips['home'] = resp.spec.cluster_ip
    except ApiException as e:
        logging.debug(e)
        logging.debug("Exception Occurred")

    for key, value in dag.items():
        task = key
        nexthosts = ''
        """
            Generate the yaml description of the required service for each task
        """
        pod_name = app_name + "-" + task
        try:
            resp = api.read_namespaced_service(pod_name, namespace)
            service_ips[task] = resp.spec.cluster_ip
        except ApiException as e:
            logging.debug(e)
            logging.debug("Exception Occurred")
    return service_ips
Ejemplo n.º 13
0
def write_wave_service_specs(**kwargs):
    """
    This function genetares the service description yaml for WAVE
    
    In this case, call argument should be:
    
      -   name: {name}
      -   Flask port: {flask_svc}
      -   target Flask Port: {flask_port}
      -   app: {label}
    

    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """
    jupiter_config.set_globals()
    # insert your values
    specific_yaml = template.format(flask_svc = jupiter_config.FLASK_SVC,
                                    flask_port = jupiter_config.FLASK_DOCKER,
                                    **kwargs)
    dep = yaml.load(specific_yaml)
    return dep
Ejemplo n.º 14
0
def check_finish_evaluation(app_name,port,num_samples):
    """Check if the evaluation script is finished
    
    Args:
        app_name (str): application name
        port (int): port number 
        num_samples (int): number of sample files
    """
    jupiter_config.set_globals()
    line = "http://localhost:%d/api/v1/namespaces/"%(port)
    line = line + jupiter_config.DEPLOYMENT_NAMESPACE + "/services/"+app_name+"-home:" + str(jupiter_config.FLASK_SVC) + "/proxy"
    print('Check if finishing evaluation sample tests')
    print(line)
    while 1:
        try:
            print("Number of output files :")
            r = requests.get(line)
            num_files = r.json()
            data = int(json.dumps(num_files))
            print(data)
            print(num_samples)
            if data==num_samples:
                print('Finish running all sample files!!!!!!!!')
                break
            time.sleep(60)
        except Exception as e: 
            print(e)
            print("Will check back later if finishing all the samples for app "+app_name)
            time.sleep(60)
Ejemplo n.º 15
0
def check_status_exec_profiler(app_name):
    """
    This function prints out all the tasks that are not running.
    If all the tasks are running: return ``True``; else return ``False``.
    """
    jupiter_config.set_globals()
    """
        This loads the kubernetes instance configuration.
        In our case this is stored in admin.conf.
        You should set the config file path in the jupiter_config.py file.
    """
    dag_info = utilities.k8s_read_config(path1)
    dag = dag_info[1]

    config.load_kube_config(config_file=jupiter_config.KUBECONFIG_PATH)

    # We have defined the namespace for deployments in jupiter_config
    namespace = jupiter_config.EXEC_NAMESPACE

    # Get proper handles or pointers to the k8-python tool to call different functions.
    extensions_v1_beta1_api = client.ExtensionsV1beta1Api()
    v1_delete_options = client.V1DeleteOptions()
    core_v1_api = client.CoreV1Api()
    """
        Loop through the list of tasks in the dag and delete the respective k8 deployment, replicaset, pods, and service.
        The deletion should follow this particular order for a proper removal.
        You can always check if a service/pod/deployment is running after running this script via kubectl command.
        E.g.,
            kubectl get svc -n "namespace name"
            kubectl get deployement -n "namespace name"
            kubectl get replicaset -n "namespace name"
            kubectl get pod -n "namespace name"
    """
    result = True
    for key, value in dag.items():

        # First check if there is a deployment existing with
        # the name = key in the respective namespac    # Check if there is a replicaset running by using the label app={key}
        # The label of kubernets are used to identify replicaset associate to each task
        label = "app=" + app_name + "-" + key
        resp = None
        if taskmap[key][1] == False:

            resp = core_v1_api.list_namespaced_pod(namespace,
                                                   label_selector=label)
            # if a pod is running just delete it
            if resp.items:
                a = resp.items[0]
                if a.status.phase != "Running":
                    print("Pod ", key, "status:", a.status.phase)
                    result = False

            # print("Pod Deleted. status='%s'" % str(del_resp_2.status))

    if result:
        print("All systems GOOOOO!!")
    else:
        print("Wait before trying again!!!!!!")
    return result
Ejemplo n.º 16
0
def get_all_waves():
    """
        This function loads all of the service ips of WAVE deployments.
    """
    
    jupiter_config.set_globals()

    mapping = {}

    """
        This loads the node lists in use
    """
    path1 = jupiter_config.HERE + 'nodes.txt'
    nodes = k8s_get_nodes(path1)

    """
        This loads the kubernetes instance configuration.
        In our case this is stored in admin.conf.
        You should set the config file path in the jupiter_config.py file.
    """
    config.load_kube_config(config_file = jupiter_config.KUBECONFIG_PATH)

    """
        Loop through the list of nodes and deletes the all profiler related k8 deployment, replicaset, pods, and service.
        The deletion should follow this particular order for a proper removal.
        You can always check if a service/pod/deployment is running after running this script via kubectl command.
        E.g., 
            kubectl get svc -n "namespace name"
            kubectl get deployement -n "namespace name"
            kubectl get replicaset -n "namespace name"
            kubectl get pod -n "namespace name"
    """
    for key in nodes:

        # We have defined the namespace for deployments in jupiter_config
        namespace = jupiter_config.MAPPER_NAMESPACE

        # Get proper handles or pointers to the k8-python tool to call different functions.
        api = client.ExtensionsV1beta1Api()
        body = client.V1DeleteOptions()
        
        # First check if there is a exisitng profiler deployment with
        # the name = key in the respective namespace
        label = "app=wave_" + key
        
        resp = None
        api_2 = client.CoreV1Api()
        try:
            resp = api_2.read_namespaced_service(key, namespace)
        except ApiException as e:
            print("Exception Occurred")
        # if a service is running, kill it
        if resp:
            # print(resp.spec.cluster_ip)
            mapping[key] = resp.spec.cluster_ip
    return mapping
Ejemplo n.º 17
0
def check_status_exec_profiler_workers():
    """
    This function prints out all the workers that are not running.
    If all the workers are running: return ``True``; else return ``False``.
    """
    jupiter_config.set_globals()
    
    path1 = jupiter_config.HERE + 'nodes.txt'
    nodes = k8s_get_nodes(path1)

    """
        This loads the kubernetes instance configuration.
        In our case this is stored in admin.conf.
        You should set the config file path in the jupiter_config.py file.
    """
    config.load_kube_config(config_file = jupiter_config.KUBECONFIG_PATH)
    namespace = jupiter_config.EXEC_NAMESPACE


    # We have defined the namespace for deployments in jupiter_config

    # Get proper handles or pointers to the k8-python tool to call different functions.
    extensions_v1_beta1_api = client.ExtensionsV1beta1Api()
    v1_delete_options = client.V1DeleteOptions()
    core_v1_api = client.CoreV1Api()

    result = True
    for key in nodes:

        if key == "home":
            continue

        # First check if there is a deployment existing with
        # the name = key in the respective namespac    # Check if there is a replicaset running by using the label app={key}
        # The label of kubernets are used to identify replicaset associate to each task
        label = "app=" + key + "exec_profiler"

        resp = None

        resp = core_v1_api.list_namespaced_pod(namespace, label_selector = label)
        # if a pod is running just delete it
        if resp.items:
            a=resp.items[0]
            if a.status.phase != "Running":
                print("Pod Not Running", key)
                result = False

            # print("Pod Deleted. status='%s'" % str(del_resp_2.status))

    if result:
        print("All systems GOOOOO!!")
    else:
        print("Wait before trying again!!!!")

    return result
Ejemplo n.º 18
0
def get_k8s_exec_info():
    jupiter_config.set_globals()

    global exec_namespace, app_name, exec_home_pod_name
    exec_namespace = jupiter_config.EXEC_NAMESPACE
    app_name = jupiter_config.app_option

    cmd = "kubectl get pod -l app=%s-home --namespace=%s -o name" % (
        app_name, exec_namespace)
    cmd_output = get_command_output(cmd)

    exec_home_pod_name = cmd_output.split('/')[1].split('\\')[0]
Ejemplo n.º 19
0
def get_k8s_mapper_info():
    jupiter_config.set_globals()

    global mapper_namespace, app_name, mapper_home_pod_name
    mapper_namespace = jupiter_config.MAPPER_NAMESPACE
    app_name = jupiter_config.app_option

    cmd = "kubectl get pod -l app=%s1-home --namespace=%s -o name" % (
        app_name, mapper_namespace)
    cmd_output = get_command_output(cmd)
    print(cmd)
    print(cmd_output)
    mapper_home_pod_name = cmd_output.split('/')[1].split('\\')[0]
Ejemplo n.º 20
0
def check_status_waves():
    """Verify if all the WAVE home and workers have been deployed and UP in the system.
    """
    jupiter_config.set_globals()


    """
        This loads the node lists in use
    """
    path1 = jupiter_config.HERE + 'nodes.txt'
    nodes = k8s_get_nodes(path1)

    """
        This loads the kubernetes instance configuration.
        In our case this is stored in admin.conf.
        You should set the config file path in the jupiter_config.py file.
    """
    config.load_kube_config(config_file = jupiter_config.KUBECONFIG_PATH)
    namespace = jupiter_config.MAPPER_NAMESPACE


    # We have defined the namespace for deployments in jupiter_config

    # Get proper handles or pointers to the k8-python tool to call different functions.
    extensions_v1_beta1_api = client.ExtensionsV1beta1Api()
    v1_delete_options = client.V1DeleteOptions()
    core_v1_api = client.CoreV1Api()

    result = True
    for key in nodes:

        label = "app=wave_" + key
        resp = None

        resp = core_v1_api.list_namespaced_pod(namespace, label_selector = label)
        # if a pod is running just delete it
        if resp.items:
            a=resp.items[0]
            if a.status.phase != "Running":
                print("Pod Not Running", key)
                result = False

    if result:
        print("All systems GOOOOO!!")
    else:
        print("Wait before trying again!!!!")

    return result
Ejemplo n.º 21
0
def prepare_global_info():
    """Read configuration information
    
    Returns:
        list: port_list - The list of ports to be exposed in the heft dockers
    
    """
    jupiter_config.set_globals()
      
    sys.path.append(jupiter_config.HEFT_PATH)
    
    port_list = []
    port_list.append(jupiter_config.SSH_DOCKER)
    port_list.append(jupiter_config.FLASK_DOCKER)
    print('The list of ports to be exposed in the heft dockers are ', " ".join(port_list))

    return port_list
Ejemplo n.º 22
0
def write_exec_specs_non_dag_tasks(**kwargs):
    """
    This function genetares the deployment service description yaml for execution profiler worker (non DAG tasks)
    
    In this case, call argument should be:
    
      -   app: {name}
      -   image: {image}
      -   SSH Port: {ssh_port}
      -   Mongo Port: {mongo_port}
      -   Flask Port: {flask_port}
      -   FLAG: {flag}
      -   INPUTNUM: {inputnum}
      -   CHILD_NODES: {child}
      -   CHILD_NODES_IPS: {child_ips}
      -   NODE_NAME: {node_name}
      -   HOME_NODE: {home_node_ip}
      -   OWN_IP: {own_ip}
      -   ALL_NODES: {all_node}
      -   ALL_NODES_IPS: {all_node_ips}
    

    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """

    jupiter_config.set_globals()

    INI_PATH = jupiter_config.APP_PATH + 'app_config.ini'
    config = configparser.ConfigParser()
    config.read(INI_PATH)

    # insert your values

    specific_yaml = template_nondag.format(
        ssh_port=jupiter_config.SSH_DOCKER,
        flask_port=jupiter_config.FLASK_DOCKER,
        mongo_port=jupiter_config.MONGO_DOCKER,
        **kwargs)

    dep = yaml.load(specific_yaml, Loader=yaml.BaseLoader)

    return add_app_specific_ports(dep)
Ejemplo n.º 23
0
def run_remote_stress(hostname):
    jupiter_config.set_globals()
    ssh = connect_remote_ssh(hostname)
    cmd_to_execute = "sudo docker pull " + jupiter_config.STRESS_IMAGE
    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd_to_execute,
                                                         get_pty=True)
    for line in ssh_stdout:
        logging.debug(line)
    cmd_to_execute = "sudo docker run -d --name sim " + jupiter_config.STRESS_IMAGE
    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd_to_execute,
                                                         get_pty=True)
    for line in ssh_stdout:
        logging.debug(line)
    cmd_to_execute = "sudo docker exec -it sim python3 /stress_test.py"
    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd_to_execute,
                                                         get_pty=True)
    for line in ssh_stdout:
        logging.info(line)
Ejemplo n.º 24
0
def export_circe_log():
    """Export circe home log for evaluation, should only use when for non-static mapping
    """
    jupiter_config.set_globals()
    path1 = jupiter_config.APP_PATH + 'configuration.txt'
    dag_info = k8s_read_dag(path1)
    dag = dag_info[1]
    print(dag)
    config.load_kube_config(config_file=jupiter_config.KUBECONFIG_PATH)
    core_v1_api = client.CoreV1Api()
    resp = core_v1_api.list_namespaced_pod(jupiter_config.DEPLOYMENT_NAMESPACE)
    for i in resp.items:
        if i.metadata.name.startswith('home'):
            circe_name = i.metadata.name
            break
    print('******************* Circe pod to export')
    print(circe_name)
    get_pod_logs(jupiter_config.DEPLOYMENT_NAMESPACE, circe_name)
Ejemplo n.º 25
0
def main():
    """ 
        Deploy num_dags of the application specified by app_name
    """
    jupiter_config.set_globals()
    app_name = jupiter_config.app_option
    print(app_name)
    # delete_all_exec(app_name)
    # delete_all_profilers()

    num_dags = 1
    app_list = []
    for num in range(1, num_dags + 1):
        cur_app = app_name + str(num)
        app_list.append(cur_app)
    print(app_list)

    for app_name in app_list:
        teardown_system(app_name)
Ejemplo n.º 26
0
def add_app_specific_ports(dep):
    """Add information of specific ports for the application
  
  Args:
      dep (str): deployment service description
  
  Returns:
      str: deployment service description with added specific port information for the application
  """
    jupiter_config.set_globals()

    INI_PATH = jupiter_config.APP_PATH + 'app_config.ini'
    config = configparser.ConfigParser()
    config.read(INI_PATH)

    a = dep['spec']['template']['spec']['containers'][0]['ports']
    for i in config['DOCKER_PORT']:
        a.append({'containerPort': config['DOCKER_PORT'][i]})
    return dep
Ejemplo n.º 27
0
def build_push_stress():
    jupiter_config.set_globals()
    logging.debug('Stress image : ' + jupiter_config.STRESS_IMAGE)
    # Master node on DCOMP n0
    logging.warn('TODO: prepare_stress_test.py assumes hostnames using',
                 'mergetb setup instructions. needs refactor.')
    ssh = connect_remote_ssh('n0')
    cmd_to_execute = '(cd Jupiter/simulation/stress_test/;' + \
        'sudo docker build -f Dockerfile . -t %s)' % \
        (jupiter_config.STRESS_IMAGE)
    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd_to_execute,
                                                         get_pty=True)
    for line in ssh_stdout:
        logging.debug(line)
    cmd_to_execute = "sudo docker push " + jupiter_config.STRESS_IMAGE
    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd_to_execute,
                                                         get_pty=True)
    for line in ssh_stdout:
        logging.debug(line)
Ejemplo n.º 28
0
def prepare_global_info():
    """Read configuration information from ``app_config.ini``
    
    Returns:
        - list: port_list_home - The list of ports to be exposed in the exec home dockers
        - list: port_list_worker - The list of ports to be exposed in the exec worker dockers
    """
    
    jupiter_config.set_globals()
    INI_PATH  = jupiter_config.APP_PATH + 'app_config.ini'
    config = configparser.ConfigParser()
    config.read(INI_PATH)
    sys.path.append(jupiter_config.STREAM_PATH)
    port_list_home = []
    port_list_home.append(jupiter_config.SSH_DOCKER)
    port_list_home.append(jupiter_config.FLASK_DOCKER)
    logging.debug('The list of ports to be exposed in the sim home are %s', " ".join(port_list_home))

    return port_list_home
Ejemplo n.º 29
0
def write_exec_specs_home_control(**kwargs):
    """
    This function genetares the description yaml for execution profiler
     
    In this case, call argument should be:
    
      -   app: {name}
      -   image: {image}
      -   SSH Port: {ssh_port}
      -   Mongo Port: {mongo_port}
      -   FLAG: {flag}
      -   INPUTNUM: {inputnum}
      -   CHILD_NODES: {child}
      -   CHILD_NODES_IPS: {child_ips}
      -   NODE_NAME: {node_name}
      -   HOME_NODE: {home_node_ip}
      -   OWN_IP: {own_ip}
      -   ALL_NODES: {all_node}
      -   ALL_NODES_IPS: {all_node_ips}
      -   ALL_PROFILERS_IPS: {allprofiler_ips}
      -   ALL_PROFILERS_NAMES: {allprofiler_names}

    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """

    # insert your values

    jupiter_config.set_globals()

    specific_yaml = template_home.format(
        ssh_port=jupiter_config.SSH_DOCKER,
        flask_port=jupiter_config.FLASK_DOCKER,
        mongo_port=jupiter_config.MONGO_DOCKER,
        **kwargs)

    dep = yaml.load(specific_yaml, Loader=yaml.BaseLoader)

    return add_app_specific_ports(dep)
Ejemplo n.º 30
0
def write_exec_service_specs(**kwargs):
    """
    This function genetares the service description yaml for execution profiler worker
    
    In this case, call argument should be:
    
      -   name: {name}
      -   SSH port: {ssh_svc}
      -   target SSH Port: {ssh_port}
      -   Flask port: {flask_svc}
      -   target Flask Port: {flask_port}
      -   Mongo port: {mongo_svc}
      -   target Mongo Port: {mongo_port}
      -   app: {label}
    

    Args:
        ``**kwargs``: list of key value pair
    
    Returns:
        dict: loaded configuration 
    """

    jupiter_config.set_globals()

    INI_PATH = jupiter_config.APP_PATH + 'app_config.ini'
    config = configparser.ConfigParser()
    config.read(INI_PATH)

    # insert your values
    specific_yaml = template_worker.format(
        ssh_svc=jupiter_config.SSH_SVC,
        ssh_port=jupiter_config.SSH_DOCKER,
        flask_svc=jupiter_config.FLASK_SVC,
        flask_port=jupiter_config.FLASK_DOCKER,
        mongo_svc=jupiter_config.MONGO_SVC,
        mongo_port=jupiter_config.MONGO_DOCKER,
        **kwargs)
    dep = yaml.load(specific_yaml)
    return dep