From 8e6a31ba876ea5054815fdfa4ddd19ed11163bfb Mon Sep 17 00:00:00 2001 From: Zhicheng Zhang Date: Mon, 28 Oct 2024 19:52:09 +0800 Subject: [PATCH] remove oss --- .../code_interpreter/code_interpreter.py | 31 ------------------- requirements.txt | 1 - 2 files changed, 32 deletions(-) diff --git a/modelscope_agent/tools/code_interpreter/code_interpreter.py b/modelscope_agent/tools/code_interpreter/code_interpreter.py index eba72e5d..dc283a6f 100644 --- a/modelscope_agent/tools/code_interpreter/code_interpreter.py +++ b/modelscope_agent/tools/code_interpreter/code_interpreter.py @@ -92,37 +92,6 @@ def __del__(self): signal.signal(signal.SIGTERM, self._kill_kernels) signal.signal(signal.SIGINT, self._kill_kernels) - def __upload(self, - src_file, - oss_path, - max_retries=3, - retry_delay=1, - delete_src=True): - result = '' - for i in range(max_retries): - try: - _ = self.bucket.put_object_from_file(oss_path, src_file) - print(f'The put action result is {_}') - - _ = self.bucket.put_object_acl(oss_path, - oss2.OBJECT_ACL_PUBLIC_READ) - print(f'The acl setting result is {_}') - - result = self.bucket.sign_url('GET', oss_path, 3600) - break - except Exception as e: - print(f'Error uploading file: {e}') - if i < max_retries - 1: - print(f'Retrying in {retry_delay} seconds...') - time.sleep(retry_delay) - else: - os.remove(src_file) - raise IOError(f'Exceed the Max retry with error {e}') - - if delete_src: - os.remove(src_file) - return result - def build(self): if self.nb_client.kc is None or not self.nb_client.kc.is_alive(): self.nb_client.create_kernel_manager() diff --git a/requirements.txt b/requirements.txt index 60a7476a..89d4a979 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,6 @@ modelscope[framework]>=1.16.0 openai opencv-python openpyxl -oss2 pdfminer.six Pillow pydantic>=2.3.0