geobox 1.0.0__py3-none-any.whl → 1.1.0__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.
geobox/task.py CHANGED
@@ -168,8 +168,31 @@ class Task(Base):
168
168
 
169
169
  return int((current / total) * 100)
170
170
 
171
+
172
+ def _wait(self, timeout: Union[int, None] = None, interval: int = 1, progress_bar: bool = True) -> 'TaskStatus':
173
+ start_time = time.time()
174
+ last_progress = 0
175
+ pbar = self._create_progress_bar() if progress_bar else None
176
+
177
+ try:
178
+ while True:
179
+ self._check_timeout(start_time, timeout)
180
+ status = self.status
181
+
182
+ if self._is_final_state(status):
183
+ self._update_progress_bar(pbar, last_progress, status)
184
+ return TaskStatus(status)
185
+
186
+ if pbar:
187
+ last_progress = self._update_progress_bar(pbar, last_progress)
188
+
189
+ time.sleep(interval)
190
+ finally:
191
+ if pbar:
192
+ pbar.close()
171
193
 
172
- def wait(self, timeout: Union[int, None] = None, interval: int = 1, progress_bar: bool = True) -> 'TaskStatus':
194
+
195
+ def wait(self, timeout: Union[int, None] = None, interval: int = 1, progress_bar: bool = True, retry: int = 3) -> 'TaskStatus':
173
196
  """
174
197
  Wait for the task to finish.
175
198
 
@@ -177,6 +200,7 @@ class Task(Base):
177
200
  timeout (int, optional): Maximum time to wait in seconds.
178
201
  interval (int, optional): Time between status checks in seconds.
179
202
  progress_bar (bool, optional): Whether to show a progress bar. default: True
203
+ retry (int, optional): Number of times to retry if waiting for the task fails. default is 3
180
204
 
181
205
  Returns:
182
206
  TaskStatus: the status of the task(SUCCESS, FAILURE, ABORTED, PENDING, PROGRESS)
@@ -191,26 +215,16 @@ class Task(Base):
191
215
  >>> task = Task.get_task(client, uuid="12345678-1234-5678-1234-567812345678")
192
216
  >>> task.wait() # return the status of the task
193
217
  """
194
- start_time = time.time()
195
- last_progress = 0
196
- pbar = self._create_progress_bar() if progress_bar else None
197
-
198
- try:
199
- while True:
200
- self._check_timeout(start_time, timeout)
201
- status = self.status
202
-
203
- if self._is_final_state(status):
204
- self._update_progress_bar(pbar, last_progress, status)
205
- return TaskStatus(status)
206
-
207
- if pbar:
208
- last_progress = self._update_progress_bar(pbar, last_progress)
209
-
218
+ last_exception = None
219
+
220
+ for attempt in range(1, retry + 1):
221
+ try:
222
+ return self._wait(timeout, interval, progress_bar)
223
+ except Exception as e:
224
+ last_exception = e
225
+ print(f"[Retry {attempt}/{retry}] Task wait failed: {e}")
210
226
  time.sleep(interval)
211
- finally:
212
- if pbar:
213
- pbar.close()
227
+ raise last_exception
214
228
 
215
229
 
216
230
  def _create_progress_bar(self) -> 'tqdm':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geobox
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: SDK for Geobox's APIs
5
5
  Author-email: Hamid Heydari <heydari.h62@gmail.com>
6
6
  License: MIT
@@ -29,7 +29,7 @@ Dynamic: license-file
29
29
 
30
30
  Geobox® is a cloud-based GIS platform that enables users (local governments, companies and individuals) to easily upload their geo-spatial data, publish them as geo-services, visualize and analyze their geo-content (geo-data or -services) and share them with others. Geobox is a modern, world-class and cloud-ready geo-spatial platform that provides standard, safe, efficient and easy to use GI-Services.
31
31
 
32
- Geobox SDK provides seamless integration with the Geobox API, enabling developers to work with geospatial data and services programmatically. This comprehensive toolkit empowers applications to leverage advanced geospatial capabilities including data management and analysis.
32
+ Geobox python SDK provides seamless integration with the Geobox API, enabling developers to work with geospatial data and services programmatically. This comprehensive toolkit empowers applications to leverage advanced geospatial capabilities including data management and analysis.
33
33
 
34
34
  Installation
35
35
  ============
@@ -20,7 +20,7 @@ geobox/raster.py,sha256=9Qnv9CQvgVxuNx1khDPQhHZEcopXofIPYBnRrx40FVk,26495
20
20
  geobox/route.py,sha256=cKZTTHBHM8woWbhHIpCvrRX_doJcTkGktouee0z7oG0,2723
21
21
  geobox/scene.py,sha256=Sz2tiyJk-bXYjktfcp1d2gGrW3gt2T4D1FAMoRHOCng,11369
22
22
  geobox/settings.py,sha256=rGRdM18Vo7xnjfZXPLRMbKeoVC_lZmzkNRPS0SQv05o,5660
23
- geobox/task.py,sha256=0X4PbKRkHz-M1l9RMZzQ-JezOf0J7ygpmwim9FGqJW4,12752
23
+ geobox/task.py,sha256=lACZ-ix3BAAU1-pNnbHC2noAtt79swrkmkCczEO7D2A,13364
24
24
  geobox/tile3d.py,sha256=MHDoj2OIUf3VMQtq7ysrayh8njAPSgwgPJCm4ySEB7A,10472
25
25
  geobox/tileset.py,sha256=F_oEV0TERMc2seLcYNu-i_TF4MNSdXPUWcxBCSR8aFw,22242
26
26
  geobox/usage.py,sha256=_54xL-n-2Bg9wGpoOBKnh85WqdpMWEtqxRJVaFlVWe0,7908
@@ -30,8 +30,8 @@ geobox/vectorlayer.py,sha256=xnYsJei-bpKgM_EJlRbZ-bAIHdmvfU-VZ2t-NEEJCfc,49420
30
30
  geobox/version.py,sha256=0GLPhxCeEb2bAkdpPJWtXPXc1KP6kQ_TOMwLAL0ldo0,9374
31
31
  geobox/view.py,sha256=fRYlzNu4eGl6Zx9gPom47BkVE8DfWLj0bNlW2-u4TOU,37390
32
32
  geobox/workflow.py,sha256=6hKnSw4G0_ZlgmUb0g3fxT-UVsFbiYpF2FbEO5fpQv0,11606
33
- geobox-1.0.0.dist-info/licenses/LICENSE,sha256=AvFB7W94sJYKLDhBxLRshL3upexCOG8HQY_1JibB96w,1063
34
- geobox-1.0.0.dist-info/METADATA,sha256=YrdDPLOnpVmt6SB3z4zcjlhLZ-IDPGamXOkiXPPhOR4,2549
35
- geobox-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
- geobox-1.0.0.dist-info/top_level.txt,sha256=ppXH8Bu2mlB-pLQ6lsoWEm2Gr6wZx1uzkhetsYA5ins,7
37
- geobox-1.0.0.dist-info/RECORD,,
33
+ geobox-1.1.0.dist-info/licenses/LICENSE,sha256=AvFB7W94sJYKLDhBxLRshL3upexCOG8HQY_1JibB96w,1063
34
+ geobox-1.1.0.dist-info/METADATA,sha256=7tl1V2oQpCqPITA_wXvZ2_zr8vCtu5URSxQ81u5Fe-E,2556
35
+ geobox-1.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
36
+ geobox-1.1.0.dist-info/top_level.txt,sha256=ppXH8Bu2mlB-pLQ6lsoWEm2Gr6wZx1uzkhetsYA5ins,7
37
+ geobox-1.1.0.dist-info/RECORD,,
File without changes