matrice 1.0.98850__py3-none-any.whl → 1.0.98851__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  """Module providing task_utils functionality."""
2
2
 
3
3
  import os
4
- import shlex
5
- import subprocess
4
+ import shutil
5
+ import urllib.request
6
+ import zipfile
6
7
  from matrice.utils import log_errors
7
8
 
8
9
 
@@ -30,24 +31,46 @@ def setup_workspace_and_run_task(
30
31
  if os.path.exists(workspace_dir):
31
32
  return
32
33
  os.makedirs(workspace_dir, exist_ok=True)
33
- download_codebase_cmd = (
34
- f"curl -L -o {shlex.quote(codebase_zip_path)} {shlex.quote(model_codebase_url)}"
35
- )
36
- subprocess.run(
37
- download_codebase_cmd,
38
- shell=True,
39
- check=True,
40
- )
41
- unzip_codebase_cmd = (
42
- f"unzip -o {shlex.quote(codebase_zip_path)} -d {shlex.quote(workspace_dir)}"
43
- )
44
- subprocess.run(unzip_codebase_cmd, shell=True, check=True)
45
- move_files_cmd = f"rsync -av {shlex.quote(workspace_dir)}/*/ {shlex.quote(workspace_dir)}/ "
46
- subprocess.run(move_files_cmd, shell=True, check=True)
34
+
35
+ # Download codebase ZIP file
36
+ urllib.request.urlretrieve(model_codebase_url, codebase_zip_path)
37
+
38
+ # Extract ZIP file with overwrite
39
+ with zipfile.ZipFile(codebase_zip_path, 'r') as zip_ref:
40
+ zip_ref.extractall(workspace_dir)
41
+
42
+ # Move files from subdirectories to workspace root (equivalent to rsync -av)
43
+ for root, dirs, files in os.walk(workspace_dir):
44
+ # Skip the workspace_dir itself to avoid moving files to themselves
45
+ if root == workspace_dir:
46
+ continue
47
+
48
+ for file in files:
49
+ src_file = os.path.join(root, file)
50
+ dst_file = os.path.join(workspace_dir, file)
51
+
52
+ # If destination file exists, overwrite it (equivalent to rsync -av behavior)
53
+ if os.path.exists(dst_file):
54
+ os.remove(dst_file)
55
+
56
+ shutil.move(src_file, dst_file)
57
+
58
+ # Remove empty directories after moving files
59
+ for dir_name in dirs:
60
+ dir_path = os.path.join(root, dir_name)
61
+ if os.path.exists(dir_path) and not os.listdir(dir_path):
62
+ os.rmdir(dir_path)
63
+
64
+ # Clean up any remaining empty subdirectories
65
+ for root, dirs, files in os.walk(workspace_dir, topdown=False):
66
+ if root == workspace_dir:
67
+ continue
68
+ if not files and not dirs:
69
+ try:
70
+ os.rmdir(root)
71
+ except OSError:
72
+ pass # Directory might not be empty or might not exist
73
+
74
+ # Download requirements.txt if URL is provided
47
75
  if model_codebase_requirements_url:
48
- download_requirements_cmd = f"curl -L -o {shlex.quote(requirements_txt_path)} {shlex.quote(model_codebase_requirements_url)}"
49
- subprocess.run(
50
- download_requirements_cmd,
51
- shell=True,
52
- check=True,
53
- )
76
+ urllib.request.urlretrieve(model_codebase_requirements_url, requirements_txt_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice
3
- Version: 1.0.98850
3
+ Version: 1.0.98851
4
4
  Summary: SDK for connecting to matrice.ai services
5
5
  Home-page: https://github.com/matrice-ai/python-sdk
6
6
  Author: Matrice.ai
@@ -31,7 +31,7 @@ matrice/compute_manager/prechecks.py,sha256=sarrX0DIUWRfWvCowTANiMvSi2VPZ-5tCEdZ
31
31
  matrice/compute_manager/resources_tracker.py,sha256=84yzWYyLZmd2wENnKMk-mBUMAhE3CZ7oyZ3-5hnAwdI,16178
32
32
  matrice/compute_manager/scaling.py,sha256=95gt9KxYLtcOskSpdbC0ddbduSgZuDD6bGsJX-SVlwc,22976
33
33
  matrice/compute_manager/shutdown_manager.py,sha256=3m0DjItl1uSyTO7fvQb-IV8lapNX31Zul8FG0yCge0M,5245
34
- matrice/compute_manager/task_utils.py,sha256=gBmlD4Fw73mm6Z3keXMSk33joF_Kkf_6CucR1iyciME,1761
34
+ matrice/compute_manager/task_utils.py,sha256=hwT3_RyCu7RTH7T83NYNHBJ8XXkS8V3sUSb3oO0QNrU,2626
35
35
  matrice/data_processing/__init__.py,sha256=JqYtcyzrQGSXN2EmQBjS4rqwj0CKe0tg9x1Nd3UAAgQ,120
36
36
  matrice/data_processing/client.py,sha256=AtimRASg8nH3mxwwih1EHvvHNeXl9NvJhIJHjLjSxHY,55309
37
37
  matrice/data_processing/client_utils.py,sha256=q0bJg6bmlUTzy83RSuViCcpazHWgRgKgx77fqDqT2kQ,50121
@@ -137,8 +137,8 @@ matrice/deploy/utils/post_processing/utils/format_utils.py,sha256=ce2VpQicTYKfxu
137
137
  matrice/deploy/utils/post_processing/utils/geometry_utils.py,sha256=BWfdM6RsdJTTLR1GqkWfdwpjMEjTCJyuBxA4zVGKdfk,9623
138
138
  matrice/deploy/utils/post_processing/utils/smoothing_utils.py,sha256=gQPykV1HGh-IMMz_3fumgtrhpyCRgXMS1hOEDcLRMO0,12542
139
139
  matrice/deploy/utils/post_processing/utils/tracking_utils.py,sha256=rWxuotnJ3VLMHIBOud2KLcu4yZfDp7hVPWUtNAq_2xw,8288
140
- matrice-1.0.98850.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
141
- matrice-1.0.98850.dist-info/METADATA,sha256=0DEEGtD_S91fmHYOV3wONYu3S94DMa7XHrBOpA4rwTk,14624
142
- matrice-1.0.98850.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
- matrice-1.0.98850.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
144
- matrice-1.0.98850.dist-info/RECORD,,
140
+ matrice-1.0.98851.dist-info/licenses/LICENSE.txt,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
141
+ matrice-1.0.98851.dist-info/METADATA,sha256=HvjNufQVAR1bCTJoIT5xaBsSflOX1g3pXmezm5937uE,14624
142
+ matrice-1.0.98851.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
143
+ matrice-1.0.98851.dist-info/top_level.txt,sha256=P97js8ur6o5ClRqMH3Cjoab_NqbJ6sOQ3rJmVzKBvMc,8
144
+ matrice-1.0.98851.dist-info/RECORD,,