rapidata 1.4.2__py3-none-any.whl → 1.4.4__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 rapidata might be problematic. Click here for more details.
- rapidata/rapidata_client/order/rapidata_order.py +25 -18
- rapidata/rapidata_client/rapidata_client.py +3 -4
- {rapidata-1.4.2.dist-info → rapidata-1.4.4.dist-info}/METADATA +1 -1
- {rapidata-1.4.2.dist-info → rapidata-1.4.4.dist-info}/RECORD +6 -6
- {rapidata-1.4.2.dist-info → rapidata-1.4.4.dist-info}/LICENSE +0 -0
- {rapidata-1.4.2.dist-info → rapidata-1.4.4.dist-info}/WHEEL +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
from time import sleep
|
|
2
2
|
from rapidata.rapidata_client.dataset.rapidata_dataset import RapidataDataset
|
|
3
3
|
from rapidata.service.openapi_service import OpenAPIService
|
|
4
4
|
import json
|
|
@@ -61,11 +61,11 @@ class RapidataOrder:
|
|
|
61
61
|
:param refresh_rate: How often to refresh the progress bar, in seconds.
|
|
62
62
|
:type refresh_rate: float
|
|
63
63
|
"""
|
|
64
|
-
total_rapids = self.
|
|
64
|
+
total_rapids = self._get_workflow_progress().total
|
|
65
65
|
with tqdm(total=total_rapids, desc="Processing order", unit="rapids") as pbar:
|
|
66
66
|
completed_rapids = 0
|
|
67
67
|
while True:
|
|
68
|
-
current_completed = self.
|
|
68
|
+
current_completed = self._get_workflow_progress().completed
|
|
69
69
|
if current_completed > completed_rapids:
|
|
70
70
|
pbar.update(current_completed - completed_rapids)
|
|
71
71
|
completed_rapids = current_completed
|
|
@@ -73,7 +73,7 @@ class RapidataOrder:
|
|
|
73
73
|
if completed_rapids >= total_rapids:
|
|
74
74
|
break
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
sleep(refresh_rate)
|
|
77
77
|
|
|
78
78
|
def _get_workflow_id(self):
|
|
79
79
|
if self._workflow_id:
|
|
@@ -86,31 +86,38 @@ class RapidataOrder:
|
|
|
86
86
|
self._workflow_id = cast(WorkflowArtifactModel, pipeline.artifacts["workflow-artifact"].actual_instance).workflow_id
|
|
87
87
|
break
|
|
88
88
|
except Exception:
|
|
89
|
-
|
|
89
|
+
sleep(2)
|
|
90
90
|
if not self._workflow_id:
|
|
91
|
-
raise Exception("Order has not started yet. Please wait for a few seconds and try again.")
|
|
91
|
+
raise Exception("Order has not started yet. Please start it or wait for a few seconds and try again.")
|
|
92
92
|
return self._workflow_id
|
|
93
|
-
|
|
94
|
-
def
|
|
95
|
-
workflow_id = self._get_workflow_id()
|
|
96
|
-
return self.openapi_service.workflow_api.workflow_get_progress_get(workflow_id).total
|
|
97
|
-
|
|
98
|
-
def _get_completed_rapids(self):
|
|
93
|
+
|
|
94
|
+
def _get_workflow_progress(self):
|
|
99
95
|
workflow_id = self._get_workflow_id()
|
|
100
|
-
|
|
96
|
+
progress = None
|
|
97
|
+
for _ in range(2):
|
|
98
|
+
try:
|
|
99
|
+
progress = self.openapi_service.workflow_api.workflow_get_progress_get(workflow_id)
|
|
100
|
+
break
|
|
101
|
+
except Exception:
|
|
102
|
+
sleep(5)
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return progress
|
|
104
|
+
if not progress:
|
|
105
|
+
raise Exception(f"Failed to get progress. Please try again in a few seconds.")
|
|
106
|
+
|
|
107
|
+
return progress
|
|
106
108
|
|
|
109
|
+
|
|
107
110
|
def get_results(self):
|
|
108
111
|
"""
|
|
109
|
-
Gets the results of the order.
|
|
112
|
+
Gets the results of the order.
|
|
113
|
+
If the order is still processing, this method will block until the order is completed and then return the results.
|
|
110
114
|
|
|
111
115
|
:return: The results of the order.
|
|
112
116
|
:rtype: dict
|
|
113
117
|
"""
|
|
118
|
+
while self.get_status().state == "Processing":
|
|
119
|
+
sleep(5)
|
|
120
|
+
|
|
114
121
|
try:
|
|
115
122
|
# Get the raw result string
|
|
116
123
|
result_str = self.openapi_service.order_api.order_result_get(id=self.order_id)
|
|
@@ -107,13 +107,12 @@ class RapidataClient:
|
|
|
107
107
|
name=order.order_name,
|
|
108
108
|
openapi_service=self.openapi_service)
|
|
109
109
|
|
|
110
|
-
def find_orders(self, name: str = "", amount: int = 1
|
|
111
|
-
"""Find your orders given criteria. If nothing is provided, it will return the most recent order.
|
|
110
|
+
def find_orders(self, name: str = "", amount: int = 1) -> list[RapidataOrder]:
|
|
111
|
+
"""Find your recent orders given criteria. If nothing is provided, it will return the most recent order.
|
|
112
112
|
|
|
113
113
|
Args:
|
|
114
114
|
name (str, optional): The name of the order - matching order will contain the name. Defaults to "" for any order.
|
|
115
115
|
amount (int, optional): The amount of orders to return. Defaults to 1.
|
|
116
|
-
latest (bool, optional): If True, the most recent orders will be returned. If False, the oldest orders will be returned. Defaults to True.
|
|
117
116
|
|
|
118
117
|
Returns:
|
|
119
118
|
list[RapidataOrder]: A list of RapidataOrder instances.
|
|
@@ -122,7 +121,7 @@ class RapidataClient:
|
|
|
122
121
|
order_page_result = self.openapi_service.order_api.order_query_get(QueryOrdersModel(
|
|
123
122
|
page=PageInfo(index=1, size=amount),
|
|
124
123
|
filter=RootFilter(filters=[Filter(field="OrderName", operator="Contains", value=name)]),
|
|
125
|
-
sortCriteria=[SortCriterion(direction="Desc"
|
|
124
|
+
sortCriteria=[SortCriterion(direction="Desc", propertyName="OrderDate")]
|
|
126
125
|
))
|
|
127
126
|
|
|
128
127
|
except BadRequestException as e:
|
|
@@ -341,9 +341,9 @@ rapidata/rapidata_client/metadata/prompt_metadata.py,sha256=_FypjKWrC3iKUO_G2CVw
|
|
|
341
341
|
rapidata/rapidata_client/metadata/public_text_metadata.py,sha256=LTiBQHs6izxQ6-C84d6Pf7lL4ENTDgg__HZnDKvzvMc,511
|
|
342
342
|
rapidata/rapidata_client/metadata/transcription_metadata.py,sha256=THtDEVCON4UlcXHmXrjilaOLHys4TrktUOPGWnXaCcc,631
|
|
343
343
|
rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
344
|
-
rapidata/rapidata_client/order/rapidata_order.py,sha256=
|
|
344
|
+
rapidata/rapidata_client/order/rapidata_order.py,sha256=IMozRlrYK_yqGLk0GQbLNYL_RRb7gUcSgDe6NUjOEEE,4812
|
|
345
345
|
rapidata/rapidata_client/order/rapidata_order_builder.py,sha256=QvICzduLAuAkf8qFKxHV3zAag838WnV9lEzWdD4dxI0,15926
|
|
346
|
-
rapidata/rapidata_client/rapidata_client.py,sha256=
|
|
346
|
+
rapidata/rapidata_client/rapidata_client.py,sha256=UKFDbck3TOcSIRM31gHpl7vpSCHd3jPrjiTODfBPH44,6956
|
|
347
347
|
rapidata/rapidata_client/referee/__init__.py,sha256=Ow9MQsONhF4sX2wFK9jbvSBrpcJgtq3OglIQMkBUdIY,167
|
|
348
348
|
rapidata/rapidata_client/referee/base_referee.py,sha256=bMy7cw0a-pGNbFu6u_1_Jplu0A483Ubj4oDQzh8vu8k,493
|
|
349
349
|
rapidata/rapidata_client/referee/classify_early_stopping_referee.py,sha256=B5wsqKM3_Oc1TU_MFGiIyiXjwK1LcmaVjhzLdaL8Cgw,1797
|
|
@@ -372,7 +372,7 @@ rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5
|
|
|
372
372
|
rapidata/service/openapi_service.py,sha256=pGcOCttKZW0PVCSM7Kfehe5loh7CxmmDDbu4UJbamnI,2770
|
|
373
373
|
rapidata/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
374
374
|
rapidata/utils/image_utils.py,sha256=TldO3eJWG8IhfJjm5MfNGO0mEDm1mQTsRoA0HLU1Uxs,404
|
|
375
|
-
rapidata-1.4.
|
|
376
|
-
rapidata-1.4.
|
|
377
|
-
rapidata-1.4.
|
|
378
|
-
rapidata-1.4.
|
|
375
|
+
rapidata-1.4.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
376
|
+
rapidata-1.4.4.dist-info/METADATA,sha256=7i3T_HJVJpDWZuwxdzjy7al08xAY_yZCxZjMhdllncc,1012
|
|
377
|
+
rapidata-1.4.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
378
|
+
rapidata-1.4.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|