From ebd30ae571049775b4ff13b7bccc3f49993c4d64 Mon Sep 17 00:00:00 2001 From: Ryan Hamel Date: Tue, 9 Jul 2024 19:54:36 +0000 Subject: [PATCH] remove requests from setup.py/dev-requirements --- dev-requirements.txt | 1 - slurm/install/setup.py | 3 +-- slurm/src/slurmcc/__init__.py | 10 ++++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index c8120834..ed746032 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,3 @@ -requests==2.24.0 mypy==0.710 autoflake==1.3.1 black==19.10b0 diff --git a/slurm/install/setup.py b/slurm/install/setup.py index eea392f2..76d37142 100644 --- a/slurm/install/setup.py +++ b/slurm/install/setup.py @@ -132,8 +132,7 @@ def run(self) -> None: }, install_requires=[ "typing_extensions==3.7.4.3", - "zipp==3.19.1", - "requests == 2.24.0", + "zipp==3.19.1" ], tests_require=["pytest==3.2.3"], cmdclass={"test": PyTest, "format": Formatter, "types": TypeChecking}, diff --git a/slurm/src/slurmcc/__init__.py b/slurm/src/slurmcc/__init__.py index 09633d76..1651e6eb 100644 --- a/slurm/src/slurmcc/__init__.py +++ b/slurm/src/slurmcc/__init__.py @@ -5,7 +5,13 @@ import random from typing import Any, Callable, Optional -import requests +try: + from requests.exceptions import ConnectionError +except ImportError: + # this is only used during live testing with scalelib, so this should never happen + import logging + logging.exception() + ConnectionError = RuntimeError class AzureSlurmError(RuntimeError): @@ -22,7 +28,7 @@ def wrapped(func: Callable) -> Any: def chaos_mode(func: Callable, action: Optional[Callable] = None) -> Callable: def default_action() -> Any: raise random.choice( - [RuntimeError, ValueError, requests.exceptions.ConnectionError] + [RuntimeError, ValueError, ConnectionError] )("Random failure") action = action or default_action