diff --git a/CHANGELOG.md b/CHANGELOG.md index 944a72341..7809c45a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.10.22-dev1 +## 0.10.22-dev2 ### Enhancements diff --git a/unstructured/__version__.py b/unstructured/__version__.py index b35937535..05cb4165a 100644 --- a/unstructured/__version__.py +++ b/unstructured/__version__.py @@ -1 +1 @@ -__version__ = "0.10.22-dev1" # pragma: no cover +__version__ = "0.10.22-dev2" # pragma: no cover diff --git a/unstructured/utils.py b/unstructured/utils.py index 41bdf682f..2d02a0474 100644 --- a/unstructured/utils.py +++ b/unstructured/utils.py @@ -3,6 +3,7 @@ import importlib import json import os import platform +import subprocess from datetime import datetime from functools import wraps from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union, cast @@ -197,13 +198,42 @@ def validate_date_args(date: Optional[str] = None): def scarf_analytics(): + try: + subprocess.check_output("nvidia-smi") + gpu_present = True + except Exception: + gpu_present = False + pass + try: if os.getenv("SCARF_NO_ANALYTICS") != "true" and os.getenv("DO_NOT_TRACK") != "true": - requests.get( - "https://packages.unstructured.io/python-telemetry?version=" - + __version__ - + "&platform=" - + platform.system() - ) + if "dev" in __version__: + requests.get( + "https://packages.unstructured.io/python-telemetry?version=" + + __version__ + + "&platform=" + + platform.system() + + "&python" + + platform.python_version() + + "&arch=" + + platform.machine() + + "&gpu=" + + str(gpu_present) + + "&dev=true" + ) + else: + requests.get( + "https://packages.unstructured.io/python-telemetry?version=" + + __version__ + + "&platform=" + + platform.system() + + "&python" + + platform.python_version() + + "&arch=" + + platform.machine() + + "&gpu=" + + str(gpu_present) + + "&dev=false" + ) except Exception: pass