示例#1
0
def update_reference_data(deployment_target):
    """DEPRECATED. Load reference data into mongodb.

    Args:
        deployment_target (string): value from DEPLOYMENT_TARGETS - eg. "minikube", "gcloud-dev", etc.
    """

    check_kubernetes_context(deployment_target)

    pod_name = get_pod_name('seqr', deployment_target=deployment_target)
    if not pod_name:
        raise ValueError(
            "No 'seqr' pods found. Is the kubectl environment configured in this terminal? and have either of these pods been deployed?"
            % locals())

    # commented out because this is not loaded from settings backup
    #run_in_pod(pod_name, "python2.7 -u manage.py update_all_reference_data --omim-key '$OMIM_KEY'" % locals(), verbose=True, print_command=True)

    run_in_pod(pod_name, "mkdir -p /seqr/data/reference_data")
    run_in_pod(
        pod_name,
        "wget -N https://storage.googleapis.com/seqr-reference-data/seqr-resource-bundle.tar.gz -O /seqr/data/reference_data/seqr-resource-bundle.tar.gz"
    )
    run_in_pod(
        pod_name,
        "tar xzf /seqr/data/reference_data/seqr-resource-bundle.tar.gz -C /seqr/data/reference_data",
        verbose=True)
    run_in_pod(pod_name,
               "rm /seqr/data/reference_data/seqr-resource-bundle.tar.gz")

    # load legacy resources
    run_in_pod(pod_name, "python -u manage.py load_resources", verbose=True)
    run_in_pod(pod_name, "python -u manage.py load_omim", verbose=True)
示例#2
0
def deploy(deployment_target, components, output_dir=None, runtime_settings={}):
    """Deploy one or more components to the kubernetes cluster specified as the deployment_target.

    Args:
        deployment_target (string): value from DEPLOYMENT_TARGETS - eg. "minikube", "gcloud-dev", etc.
            indentifying which cluster to deploy these components to
        components (list): The list of component names to deploy (eg. "postgres", "phenotips" - each string must be in
            constants.DEPLOYABLE_COMPONENTS). Order doesn't matter.
        output_dir (string): path of directory where to put deployment logs and rendered config files
        runtime_settings (dict): a dictionary of other key-value pairs that override settings file(s) values.
    """
    if not components:
        raise ValueError("components list is empty")

    if components and "init-cluster" not in components:
        check_kubernetes_context(deployment_target)

    settings = prepare_settings_for_deployment(deployment_target, output_dir, runtime_settings)

    # make sure namespace exists
    if "init-cluster" not in components:
        create_namespace(settings)

    # call deploy_* functions for each component in "components" list, in the order that these components are listed in DEPLOYABLE_COMPONENTS
    for component in DEPLOYABLE_COMPONENTS:
        if component in components:
            # only deploy requested components
            func_name = "deploy_" + component.replace("-", "_")
            f = globals().get(func_name)
            if f is not None:
                f(settings)
            else:
                raise ValueError("'deploy_{}' function not found. Is '{}' a valid component name?".format(func_name, component))
def deploy(deployment_target, components, output_dir=None, runtime_settings={}):
    """Deploy one or more components to the kubernetes cluster specified as the deployment_target.

    Args:
        deployment_target (string): value from DEPLOYMENT_TARGETS - eg. "minikube", "gcloud-dev", etc.
            indentifying which cluster to deploy these components to
        components (list): The list of component names to deploy (eg. "postgres", "phenotips" - each string must be in
            constants.DEPLOYABLE_COMPONENTS). Order doesn't matter.
        output_dir (string): path of directory where to put deployment logs and rendered config files
        runtime_settings (dict): a dictionary of other key-value pairs that override settings file(s) values.
    """
    if not components:
        raise ValueError("components list is empty")

    if components and "init-cluster" not in components:
        check_kubernetes_context(deployment_target)

    settings = prepare_settings_for_deployment(deployment_target, output_dir, runtime_settings)

    # make sure namespace exists
    if "init-cluster" not in components:
        create_namespace(settings)

    # call deploy_* functions for each component in "components" list, in the order that these components are listed in DEPLOYABLE_COMPONENTS
    for component in DEPLOYABLE_COMPONENTS:
        if component in components:
            # only deploy requested components
            func_name = "deploy_" + component.replace("-", "_")
            f = globals().get(func_name)
            if f is not None:
                f(settings)
            else:
                raise ValueError("'deploy_{}' function not found. Is '{}' a valid component name?".format(func_name, component))
示例#4
0
def load_example_project(deployment_target,
                         genome_version="37",
                         cpu_limit=None,
                         start_with_step=None):
    """Load example project

    Args:
        deployment_target (string): value from DEPLOYMENT_TARGETS - eg. "minikube", "gcloud-dev", etc.
        genome_version (string): reference genome version - either "37" or "38"
    """

    project_name = "1kg"

    check_kubernetes_context(deployment_target)

    pod_name = get_pod_name('seqr', deployment_target=deployment_target)
    if not pod_name:
        raise ValueError(
            "No 'seqr' pod found. Is the kubectl environment configured in this terminal? and have either of these pods been deployed?"
            % locals())

    run_in_pod(
        pod_name,
        "wget -N https://storage.googleapis.com/seqr-reference-data/test-projects/1kg.ped"
        % locals())
    #run_in_pod(pod_name, "gsutil cp %(ped)s ." % locals())

    # TODO call APIs instead?
    run_in_pod(
        pod_name,
        "python2.7 -u -m manage create_project -p '1kg.ped' '%(project_name)s'"
        % locals(),
        verbose=True)

    if genome_version == "37":
        vcf_filename = "1kg.vcf.gz"
    elif genome_version == "38":
        vcf_filename = "1kg.liftover.GRCh38.vep.vcf.gz"
    else:
        raise ValueError("Unexpected genome_version: %s" % (genome_version, ))

    load_dataset(
        deployment_target,
        project_name=project_name,
        genome_version=genome_version,
        sample_type="WES",
        dataset_type="VARIANTS",
        cpu_limit=cpu_limit,
        start_with_step=start_with_step,
        vcf=
        "https://storage.googleapis.com/seqr-reference-data/test-projects/%(vcf_filename)s"
        % locals())
示例#5
0
def redeploy(deployment_target, components):
    if not components:
        raise ValueError("components list is empty")

    check_kubernetes_context(deployment_target)

    # call redeploy_* functions for each component in "components" list, in the order that these components are listed in DEPLOYABLE_COMPONENTS
    for component in DEPLOYABLE_COMPONENTS:
        if component in components:
            # only deploy requested components
            func_name = "redeploy_" + component.replace("-", "_")
            f = globals().get(func_name)
            if f is not None:
                f(deployment_target)
            else:
                raise ValueError(
                    "'redeploy_{}' function not found. Is '{}' a valid component name?".format(func_name, component))
def load_example_project(deployment_target, genome_version="37", cpu_limit=None, start_with_step=None):
    """Load example project

    Args:
        deployment_target (string): value from DEPLOYMENT_TARGETS - eg. "minikube", "gcloud-dev", etc.
        genome_version (string): reference genome version - either "37" or "38"
    """

    project_name = "1kg"

    check_kubernetes_context(deployment_target)

    pod_name = get_pod_name('seqr', deployment_target=deployment_target)
    if not pod_name:
        raise ValueError("No 'seqr' pod found. Is the kubectl environment configured in this terminal? and have either of these pods been deployed?" % locals())

    run_in_pod(pod_name, "wget -N https://storage.googleapis.com/seqr-reference-data/test-projects/1kg.ped" % locals())
    #run_in_pod(pod_name, "gsutil cp %(ped)s ." % locals())

    # TODO call APIs instead?
    run_in_pod(pod_name, "python2.7 -u -m manage create_project -p '1kg.ped' '%(project_name)s'" % locals(), verbose=True)

    if genome_version == "37":
        vcf_filename = "1kg.vcf.gz"
    elif genome_version == "38":
        vcf_filename = "1kg.liftover.GRCh38.vep.vcf.gz"
    else:
        raise ValueError("Unexpected genome_version: %s" % (genome_version,))

    load_dataset(
        deployment_target,
        project_name=project_name,
        genome_version=genome_version,
        sample_type="WES",
        dataset_type="VARIANTS",
        cpu_limit=cpu_limit,
        start_with_step=start_with_step,
        vcf="https://storage.googleapis.com/seqr-reference-data/test-projects/%(vcf_filename)s" % locals())
def update_reference_data(deployment_target):
    """DEPRECATED. Load reference data into mongodb.

    Args:
        deployment_target (string): value from DEPLOYMENT_TARGETS - eg. "minikube", "gcloud-dev", etc.
    """

    check_kubernetes_context(deployment_target)

    pod_name = get_pod_name('seqr', deployment_target=deployment_target)
    if not pod_name:
        raise ValueError("No 'seqr' pods found. Is the kubectl environment configured in this terminal? and have either of these pods been deployed?" % locals())

    # commented out because this is not loaded from settings backup
    #run_in_pod(pod_name, "python2.7 -u manage.py update_all_reference_data --omim-key '$OMIM_KEY'" % locals(), verbose=True, print_command=True)

    run_in_pod(pod_name, "mkdir -p /seqr/data/reference_data")
    run_in_pod(pod_name, "wget -N https://storage.googleapis.com/seqr-reference-data/seqr-resource-bundle.tar.gz -O /seqr/data/reference_data/seqr-resource-bundle.tar.gz")
    run_in_pod(pod_name, "tar xzf /seqr/data/reference_data/seqr-resource-bundle.tar.gz -C /seqr/data/reference_data", verbose=True)
    run_in_pod(pod_name, "rm /seqr/data/reference_data/seqr-resource-bundle.tar.gz")

    # load legacy resources
    run_in_pod(pod_name, "python -u manage.py load_resources", verbose=True)
    run_in_pod(pod_name, "python -u manage.py load_omim", verbose=True)