Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/deprecate-databricks-job-name' i…
Browse files Browse the repository at this point in the history
…nto test/gprofiler-no-missing-granulate-utils-dep
  • Loading branch information
Oren de Lame committed Aug 20, 2024
2 parents 0675ca6 + d9fc5dc commit cc7ca2a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 28 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ Additionally, 2 more flags need to be added to gProfiler's commandline: `--disab
* `--disable-pidns-check` is required because gProfiler won't run in the init PID NS.
* `--perf-mode=none` is required because gProfiler will not have permissions to run system-wide `perf`, so we will profile only runtime processes, such as Java. See [perf-less mode](#perf-less-mode) for more information.

### Databricks unique service names for job clusters
By using `--databricks-job-name-as-service-name`, gProfiler will use the Job Clusters' Job Name as service name.
In case gProfiler successfully managed to extract the Job Name, the service name will be `databricks-job-<JOB_NAME>`.
By default, this functionality relies on `spark.databricks.clusterUsageTags.clusterAllTags` property
to extract the Job Name.

In case gProfiler spots this property is redacted, gProfiler will use the
`spark.databricks.clusterUsageTags.clusterName` property as service name.
Expand Down
15 changes: 11 additions & 4 deletions executable.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ RUN ./phpspy_build.sh
# async-profiler glibc
FROM centos${AP_BUILDER_CENTOS} AS async-profiler-builder-glibc
WORKDIR /tmp

COPY scripts/async_profiler_env_glibc.sh .
COPY scripts/async_profiler_env_glibc.sh scripts/fix_centos7.sh ./
RUN if grep -q "CentOS Linux 7" /etc/os-release ; then \
./fix_centos7.sh; \
fi
RUN ./async_profiler_env_glibc.sh

COPY scripts/async_profiler_build_shared.sh .
Expand Down Expand Up @@ -139,10 +141,12 @@ RUN ./pyperf_build.sh --with-staticx
FROM centos${GPROFILER_BUILDER} AS build-prepare

WORKDIR /tmp
COPY scripts/fix_centos8.sh .
COPY scripts/fix_centos7.sh scripts/fix_centos8.sh ./
# fix repo links for CentOS 8, and enable powertools (required to download glibc-static)
RUN if grep -q "CentOS Linux 8" /etc/os-release ; then \
./fix_centos8.sh; \
elif grep -q "CentOS Linux 7" /etc/os-release ; then \
./fix_centos7.sh; \
fi

# update libmodulemd to fix https://bugzilla.redhat.com/show_bug.cgi?id=2004853
Expand Down Expand Up @@ -200,7 +204,10 @@ RUN python3 -m pip install --no-cache-dir --upgrade pip
FROM ${NODE_PACKAGE_BUILDER_GLIBC} as node-package-builder-glibc
USER 0
WORKDIR /tmp
COPY scripts/node_builder_glibc_env.sh .
COPY scripts/node_builder_glibc_env.sh scripts/fix_centos7.sh ./
RUN if grep -q "CentOS Linux 7" /etc/os-release ; then \
./fix_centos7.sh; \
fi
RUN ./node_builder_glibc_env.sh
COPY scripts/build_node_package.sh .
RUN ./build_node_package.sh
Expand Down
23 changes: 4 additions & 19 deletions gprofiler/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from granulate_utils.linux.ns import is_running_in_init_pid
from granulate_utils.linux.process import is_process_running
from granulate_utils.metadata.cloud import get_aws_execution_env
from granulate_utils.metadata.databricks_client import DBXWebUIEnvWrapper, get_name_from_metadata
from psutil import NoSuchProcess, Process
from requests import RequestException, Timeout

Expand Down Expand Up @@ -798,11 +797,7 @@ def parse_cmd_args() -> configargparse.Namespace:
action="store_true",
dest="databricks_job_name_as_service_name",
default=False,
help="gProfiler will set service name to Databricks' job name on ephemeral clusters. It'll delay the beginning"
" of the profiling due to repeated waiting for Spark's metrics server."
' service name format is: "databricks-job-<JOB-NAME>".'
" Note that in any case that the job name is not available due to redaction,"
" gProfiler will fallback to use the clusterName property.",
help="Deprecated! Removed in version 1.49.0",
)

parser.add_argument(
Expand Down Expand Up @@ -1019,6 +1014,9 @@ def warn_about_deprecated_args(args: configargparse.Namespace) -> None:
if args.collect_spark_metrics:
logger.warning("--collect-spark-metrics is deprecated and removed in version 1.42.0")

if args.databricks_job_name_as_service_name:
logger.warning("--databricks-job-name-as-service-name is deprecated and removed in version 1.49.0")


def main() -> None:
args = parse_cmd_args()
Expand Down Expand Up @@ -1059,19 +1057,6 @@ def main() -> None:
# assume we run in the root cgroup (when containerized, that's our view)
usage_logger = CgroupsUsageLogger(logger, "/") if args.log_usage else NoopUsageLogger()

if args.databricks_job_name_as_service_name:
# "databricks" will be the default name in case of failure with --databricks-job-name-as-service-name flag
args.service_name = "databricks"
dbx_web_ui_wrapper = DBXWebUIEnvWrapper(logger)
dbx_metadata = dbx_web_ui_wrapper.all_props_dict
if dbx_metadata is not None:
service_suffix = get_name_from_metadata(dbx_metadata)
if service_suffix is not None:
args.service_name = f"databricks-{service_suffix}"

if remote_logs_handler is not None:
remote_logs_handler.update_service_name(args.service_name)

try:
logger.info(
"Running gProfiler", version=__version__, commandline=" ".join(sys.argv[1:]), arguments=args.__dict__
Expand Down
8 changes: 8 additions & 0 deletions scripts/fix_centos7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -eu

sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
yum clean all

0 comments on commit cc7ca2a

Please sign in to comment.