truefoundry 0.4.4rc11__py3-none-any.whl → 0.4.4rc12__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.

Potentially problematic release.


This version of truefoundry might be problematic. Click here for more details.

@@ -8,7 +8,7 @@ from typing import Optional
8
8
  from fsspec.spec import DEFAULT_CALLBACK, AbstractBufferedFile, AbstractFileSystem
9
9
 
10
10
  from truefoundry.common.constants import ENV_VARS
11
- from truefoundry.common.tfy_signed_url_client import SignedURLClient
11
+ from truefoundry.common.tfy_signed_url_client import LOG_PREFIX, SignedURLClient
12
12
  from truefoundry.common.utils import log_time
13
13
 
14
14
 
@@ -21,12 +21,12 @@ class SignedURLFileSystem(AbstractFileSystem):
21
21
  token = token or ENV_VARS.TFY_INTERNAL_SIGNED_URL_SERVER_TOKEN
22
22
  self.client = SignedURLClient(base_url, token)
23
23
 
24
- @log_time
24
+ @log_time(prefix=LOG_PREFIX)
25
25
  def exists(self, path, **kwargs):
26
26
  """Check if a file exists at the given path."""
27
27
  return self.client.exists(path)
28
28
 
29
- @log_time
29
+ @log_time(prefix=LOG_PREFIX)
30
30
  def get(
31
31
  self,
32
32
  rpath,
@@ -87,7 +87,7 @@ class SignedURLFileSystem(AbstractFileSystem):
87
87
  Path(os.path.dirname(target_local_path)).mkdir(parents=True, exist_ok=True)
88
88
  self.client.download(storage_uri=rpath, local_path=target_local_path)
89
89
 
90
- @log_time
90
+ @log_time(prefix=LOG_PREFIX)
91
91
  def put(
92
92
  self,
93
93
  lpath,
@@ -134,7 +134,7 @@ class SignedURLFileSystem(AbstractFileSystem):
134
134
  rpath = os.path.join(rpath, local_path.name)
135
135
  return self.client.upload(file_path=lpath, storage_uri=rpath)
136
136
 
137
- @log_time
137
+ @log_time(prefix=LOG_PREFIX)
138
138
  def isdir(self, path):
139
139
  """Is this entry directory-like?"""
140
140
  return self.client.is_directory(path)
@@ -170,6 +170,7 @@ class SignedURLFileSystem(AbstractFileSystem):
170
170
  # Wrapping the buffer to automatically upload on close
171
171
  return io.BufferedWriter(buffer, on_close)
172
172
 
173
+ @log_time(prefix=LOG_PREFIX)
173
174
  def write(self, path, data, **kwargs):
174
175
  """
175
176
  Write data to the file at the specified path (this could be tied to open's close).
@@ -185,7 +186,7 @@ class SignedURLFileSystem(AbstractFileSystem):
185
186
  # Upload the content to the remote file system
186
187
  self.client.upload_from_bytes(content, storage_uri=path)
187
188
 
188
- @log_time
189
+ @log_time(prefix=LOG_PREFIX)
189
190
  def ls(self, path, detail=True, **kwargs):
190
191
  """List objects at path."""
191
192
  return self.client.list_files(path, detail=detail)
@@ -105,15 +105,18 @@ def resolve_tfy_host(tfy_host: Optional[str] = None) -> str:
105
105
  return tfy_host
106
106
 
107
107
 
108
- def log_time(func, prefix: str = ""):
108
+ def log_time(prefix: str = ""):
109
109
  """Decorator to log the time taken by I/O operations."""
110
110
 
111
- @wraps(func)
112
- def wrapper(*args, **kwargs):
113
- start_time = time.time()
114
- result = func(*args, **kwargs)
115
- elapsed_time = time.time() - start_time
116
- logger.info(f"{prefix} {func.__name__} took {elapsed_time:.2f} seconds")
117
- return result
111
+ def decorator(func):
112
+ @wraps(func)
113
+ def wrapper(*args, **kwargs):
114
+ start_time = time.time()
115
+ result = func(*args, **kwargs)
116
+ elapsed_time = time.time() - start_time
117
+ logger.info(f"{prefix}{func.__name__} took {elapsed_time:.2f} seconds")
118
+ return result
119
+
120
+ return wrapper
118
121
 
119
- return wrapper
122
+ return decorator
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: truefoundry
3
- Version: 0.4.4rc11
3
+ Version: 0.4.4rc12
4
4
  Summary: Truefoundry CLI
5
5
  Author: Abhishek Choudhary
6
6
  Author-email: abhishek@truefoundry.com
@@ -35,8 +35,8 @@ truefoundry/common/exceptions.py,sha256=ePpiQ_zmWe4e94gOgeMiyP_AZnKwjEBfyXsB5ScG
35
35
  truefoundry/common/request_utils.py,sha256=5xw4YGUcMf71Ncal3OfFCa-PoWDIvG3hYGCDa4Da4OI,2854
36
36
  truefoundry/common/servicefoundry_client.py,sha256=2fxmgCM-ckFHpnm6n_mL-5Z8RWN_q-dYVvFC29bkYSg,3120
37
37
  truefoundry/common/tfy_signed_url_client.py,sha256=VklNm4K4xm1CcKZ1iiT8281X6jo803AhgYdtVvvwDXY,10183
38
- truefoundry/common/tfy_signed_url_fs.py,sha256=Vc7Il077nZIGbDBQ8aTPNtJVcypYaoZHr13vV00REko,8486
39
- truefoundry/common/utils.py,sha256=XM3QsbR_kCEjyNBRpM8oRhV3kvz0xRFfAiqYG4dC1sU,3692
38
+ truefoundry/common/tfy_signed_url_fs.py,sha256=xwUR2Vx892sVuiBN5wUNagWuGxGRMecvYsuKQ5yy1rg,8626
39
+ truefoundry/common/utils.py,sha256=RS_YExw9PHfoxKr0BZhPQAsDBKssqL1PgdW6a6rBqu0,3764
40
40
  truefoundry/deploy/__init__.py,sha256=ugawKF2G02EmEXX35oZ2tec12d9oWN28Sf6mtGGIERY,2281
41
41
  truefoundry/deploy/auto_gen/models.py,sha256=4MaxkG2_5Wg6avaZRlK0D4JiVEM5rk3NU0BCiTx8VyU,82477
42
42
  truefoundry/deploy/builder/__init__.py,sha256=1qjHMNBE1poRCZW0WrG46dFM1f1IlivD5352qzsioMU,4953
@@ -353,7 +353,7 @@ truefoundry/workflow/map_task.py,sha256=2m3qGXQ90k9LdS45q8dqCCECc3qr8t2m_LMCVd1m
353
353
  truefoundry/workflow/python_task.py,sha256=SRXRLC4vdBqGjhkwuaY39LEWN6iPCpJAuW17URRdWTY,1128
354
354
  truefoundry/workflow/task.py,sha256=ToitYiKcNzFCtOVQwz1W8sRjbR97eVS7vQBdbgUQtKg,1779
355
355
  truefoundry/workflow/workflow.py,sha256=WaTqUjhwfAXDWu4E5ehuwAxrCbDJkoAf1oWmR2E9Qy0,4575
356
- truefoundry-0.4.4rc11.dist-info/METADATA,sha256=47vgw6KFJIUdkhXwbyhuVFktZ4MxdJJR9_pBuHUakGw,3102
357
- truefoundry-0.4.4rc11.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
358
- truefoundry-0.4.4rc11.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
359
- truefoundry-0.4.4rc11.dist-info/RECORD,,
356
+ truefoundry-0.4.4rc12.dist-info/METADATA,sha256=t-97uMhttorL6bHloEkl7d4ewbPEPE5lHRz3nmCywy4,3102
357
+ truefoundry-0.4.4rc12.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
358
+ truefoundry-0.4.4rc12.dist-info/entry_points.txt,sha256=TXvUxQkI6zmqJuycPsyxEIMr3oqfDjgrWj0m_9X12x4,95
359
+ truefoundry-0.4.4rc12.dist-info/RECORD,,