diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-10 12:25:33 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-10 12:25:33 +0000 |
| commit | 58a2c382e6065c19b35863d0441281e8adc41292 (patch) | |
| tree | 552aa7bc645bd1d656d40a8b6160e9d326f722ce | |
| parent | 3370a200bb4f0cef5d433f2f11e35bac2f9614c8 (diff) | |
automatic import of python-google-cloud-profiler
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-google-cloud-profiler.spec | 387 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 389 insertions, 0 deletions
@@ -0,0 +1 @@ +/google-cloud-profiler-4.0.0.tar.gz diff --git a/python-google-cloud-profiler.spec b/python-google-cloud-profiler.spec new file mode 100644 index 0000000..7c718c6 --- /dev/null +++ b/python-google-cloud-profiler.spec @@ -0,0 +1,387 @@ +%global _empty_manifest_terminate_build 0 +Name: python-google-cloud-profiler +Version: 4.0.0 +Release: 1 +Summary: Google Cloud Profiler Python Agent +License: Apache License, Version 2.0 +URL: https://github.com/GoogleCloudPlatform/cloud-profiler-python +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f5/b1/6a5f55bdcdc6d952268b91b4572b5ea31921f3e641cdbab464e6d68e5035/google-cloud-profiler-4.0.0.tar.gz +BuildArch: noarch + + +%description +# Google Cloud Python profiling agent + +Python profiling agent for +[Google Cloud Profiler](https://cloud.google.com/profiler/). + +See +[Google Cloud Profiler profiling Python code](https://cloud.google.com/profiler/docs/profiling-python) +for detailed documentation. + +## Supported OS + +Linux. Profiling Python applications is supported for Linux kernels whose +standard C library is implemented with `glibc` or with `musl`. For configuration +information specific to Linux Alpine kernels, see +[Running on Linux Alpine](https://cloud.google.com/profiler/docs/profiling-python#running_with_linux_alpine). + +## Supported Python Versions + +Python >= 3.6 + +## Installation & usage + +1. Install the profiler package using PyPI: + + ```shell + pip3 install google-cloud-profiler + ``` + +2. Enable the profiler in your application: + + ```python + import googlecloudprofiler + + def main(): + # Profiler initialization. It starts a daemon thread which continuously + # collects and uploads profiles. Best done as early as possible. + try: + googlecloudprofiler.start( + service='hello-profiler', + service_version='1.0.1', + # verbose is the logging level. 0-error, 1-warning, 2-info, + # 3-debug. It defaults to 0 (error) if not set. + verbose=3, + # project_id must be set if not running on GCP. + # project_id='my-project-id', + ) + except (ValueError, NotImplementedError) as exc: + print(exc) # Handle errors here + ``` + +## Installation on Linux Alpine + +The Python profiling agent has a native component. The base Alpine image for +Python does not have all dependencies required to build this native component +installed. To build the Python profiling agent on Alpine, one must install the +package `build-base`. + +To use the Python profiling agent on Alpine without installing additional +dependencies on to the final Alpine image, one can use a two-stage build and +compile the Python profiling agent in the first stage. + +Here is an example of a Docker image that uses a multi-stage build to compile +and install the Python profiling agent: + +``` +FROM python:3.7-alpine as builder + +# Install build-base to allow for compilation of the profiling agent. +RUN apk add --update --no-cache build-base + +# Compile the profiling agent, generating wheels for it. +RUN pip3 wheel --wheel-dir=/tmp/wheels google-cloud-profiler + + +FROM python:3.7-alpine + +# Copy over the directory containing wheels for the profiling agent. +COPY --from=builder /tmp/wheels /tmp/wheels + +# Install the profiling agent. +RUN pip3 install --no-index --find-links=/tmp/wheels google-cloud-profiler + +# Install any other required modules or dependencies, and copy an app which +# enables the profiler as described in "Enable the profiler in your +# application". +COPY ./bench.py . + +# Run the application when the docker image is run, using either CMD (as is done +# here) or ENTRYPOINT. +CMD python3 -u bench.py +``` + + +## Troubleshooting + +### Resource temporarily unavailable errors with Python + +If you see the following log entries after enabling the Profiler: + +``` +BlockingIOError: [Errno 11] Resource temporarily unavailable +Exception ignored when trying to write to the signal wakeup fd +``` + +see https://cloud.google.com/profiler/docs/troubleshooting#python-blocking for +the cause and the workaround. + +%package -n python3-google-cloud-profiler +Summary: Google Cloud Profiler Python Agent +Provides: python-google-cloud-profiler +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-google-cloud-profiler +# Google Cloud Python profiling agent + +Python profiling agent for +[Google Cloud Profiler](https://cloud.google.com/profiler/). + +See +[Google Cloud Profiler profiling Python code](https://cloud.google.com/profiler/docs/profiling-python) +for detailed documentation. + +## Supported OS + +Linux. Profiling Python applications is supported for Linux kernels whose +standard C library is implemented with `glibc` or with `musl`. For configuration +information specific to Linux Alpine kernels, see +[Running on Linux Alpine](https://cloud.google.com/profiler/docs/profiling-python#running_with_linux_alpine). + +## Supported Python Versions + +Python >= 3.6 + +## Installation & usage + +1. Install the profiler package using PyPI: + + ```shell + pip3 install google-cloud-profiler + ``` + +2. Enable the profiler in your application: + + ```python + import googlecloudprofiler + + def main(): + # Profiler initialization. It starts a daemon thread which continuously + # collects and uploads profiles. Best done as early as possible. + try: + googlecloudprofiler.start( + service='hello-profiler', + service_version='1.0.1', + # verbose is the logging level. 0-error, 1-warning, 2-info, + # 3-debug. It defaults to 0 (error) if not set. + verbose=3, + # project_id must be set if not running on GCP. + # project_id='my-project-id', + ) + except (ValueError, NotImplementedError) as exc: + print(exc) # Handle errors here + ``` + +## Installation on Linux Alpine + +The Python profiling agent has a native component. The base Alpine image for +Python does not have all dependencies required to build this native component +installed. To build the Python profiling agent on Alpine, one must install the +package `build-base`. + +To use the Python profiling agent on Alpine without installing additional +dependencies on to the final Alpine image, one can use a two-stage build and +compile the Python profiling agent in the first stage. + +Here is an example of a Docker image that uses a multi-stage build to compile +and install the Python profiling agent: + +``` +FROM python:3.7-alpine as builder + +# Install build-base to allow for compilation of the profiling agent. +RUN apk add --update --no-cache build-base + +# Compile the profiling agent, generating wheels for it. +RUN pip3 wheel --wheel-dir=/tmp/wheels google-cloud-profiler + + +FROM python:3.7-alpine + +# Copy over the directory containing wheels for the profiling agent. +COPY --from=builder /tmp/wheels /tmp/wheels + +# Install the profiling agent. +RUN pip3 install --no-index --find-links=/tmp/wheels google-cloud-profiler + +# Install any other required modules or dependencies, and copy an app which +# enables the profiler as described in "Enable the profiler in your +# application". +COPY ./bench.py . + +# Run the application when the docker image is run, using either CMD (as is done +# here) or ENTRYPOINT. +CMD python3 -u bench.py +``` + + +## Troubleshooting + +### Resource temporarily unavailable errors with Python + +If you see the following log entries after enabling the Profiler: + +``` +BlockingIOError: [Errno 11] Resource temporarily unavailable +Exception ignored when trying to write to the signal wakeup fd +``` + +see https://cloud.google.com/profiler/docs/troubleshooting#python-blocking for +the cause and the workaround. + +%package help +Summary: Development documents and examples for google-cloud-profiler +Provides: python3-google-cloud-profiler-doc +%description help +# Google Cloud Python profiling agent + +Python profiling agent for +[Google Cloud Profiler](https://cloud.google.com/profiler/). + +See +[Google Cloud Profiler profiling Python code](https://cloud.google.com/profiler/docs/profiling-python) +for detailed documentation. + +## Supported OS + +Linux. Profiling Python applications is supported for Linux kernels whose +standard C library is implemented with `glibc` or with `musl`. For configuration +information specific to Linux Alpine kernels, see +[Running on Linux Alpine](https://cloud.google.com/profiler/docs/profiling-python#running_with_linux_alpine). + +## Supported Python Versions + +Python >= 3.6 + +## Installation & usage + +1. Install the profiler package using PyPI: + + ```shell + pip3 install google-cloud-profiler + ``` + +2. Enable the profiler in your application: + + ```python + import googlecloudprofiler + + def main(): + # Profiler initialization. It starts a daemon thread which continuously + # collects and uploads profiles. Best done as early as possible. + try: + googlecloudprofiler.start( + service='hello-profiler', + service_version='1.0.1', + # verbose is the logging level. 0-error, 1-warning, 2-info, + # 3-debug. It defaults to 0 (error) if not set. + verbose=3, + # project_id must be set if not running on GCP. + # project_id='my-project-id', + ) + except (ValueError, NotImplementedError) as exc: + print(exc) # Handle errors here + ``` + +## Installation on Linux Alpine + +The Python profiling agent has a native component. The base Alpine image for +Python does not have all dependencies required to build this native component +installed. To build the Python profiling agent on Alpine, one must install the +package `build-base`. + +To use the Python profiling agent on Alpine without installing additional +dependencies on to the final Alpine image, one can use a two-stage build and +compile the Python profiling agent in the first stage. + +Here is an example of a Docker image that uses a multi-stage build to compile +and install the Python profiling agent: + +``` +FROM python:3.7-alpine as builder + +# Install build-base to allow for compilation of the profiling agent. +RUN apk add --update --no-cache build-base + +# Compile the profiling agent, generating wheels for it. +RUN pip3 wheel --wheel-dir=/tmp/wheels google-cloud-profiler + + +FROM python:3.7-alpine + +# Copy over the directory containing wheels for the profiling agent. +COPY --from=builder /tmp/wheels /tmp/wheels + +# Install the profiling agent. +RUN pip3 install --no-index --find-links=/tmp/wheels google-cloud-profiler + +# Install any other required modules or dependencies, and copy an app which +# enables the profiler as described in "Enable the profiler in your +# application". +COPY ./bench.py . + +# Run the application when the docker image is run, using either CMD (as is done +# here) or ENTRYPOINT. +CMD python3 -u bench.py +``` + + +## Troubleshooting + +### Resource temporarily unavailable errors with Python + +If you see the following log entries after enabling the Profiler: + +``` +BlockingIOError: [Errno 11] Resource temporarily unavailable +Exception ignored when trying to write to the signal wakeup fd +``` + +see https://cloud.google.com/profiler/docs/troubleshooting#python-blocking for +the cause and the workaround. + +%prep +%autosetup -n google-cloud-profiler-4.0.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-google-cloud-profiler -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 4.0.0-1 +- Package Spec generated @@ -0,0 +1 @@ +fe22ee05fa1908cae2f455d89a33c318 google-cloud-profiler-4.0.0.tar.gz |
