arkindex-base-worker 0.4.0a1__tar.gz → 0.4.0a2__tar.gz
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.
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/PKG-INFO +1 -1
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_base_worker.egg-info/PKG-INFO +1 -1
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/training.py +16 -13
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/pyproject.toml +1 -1
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_training.py +15 -41
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/LICENSE +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/README.md +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_base_worker.egg-info/SOURCES.txt +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_base_worker.egg-info/dependency_links.txt +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_base_worker.egg-info/requires.txt +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_base_worker.egg-info/top_level.txt +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/__init__.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/cache.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/image.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/models.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/utils.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/__init__.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/base.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/classification.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/corpus.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/dataset.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/element.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/entity.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/image.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/metadata.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/task.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/transcription.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/version.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/hooks/pre_gen_project.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/setup.cfg +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/__init__.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/conftest.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_base_worker.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_cache.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_dataset_worker.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_element.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/__init__.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_classifications.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_cli.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_corpus.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_dataset.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_elements.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_entities.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_image.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_metadata.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_task.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_transcriptions.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_worker.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_image.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_merge.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_utils.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/worker-demo/tests/__init__.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/worker-demo/tests/conftest.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/worker-demo/tests/test_worker.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/worker-demo/worker_demo/__init__.py +0 -0
- {arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/worker-demo/worker_demo/worker.py +0 -0
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/training.py
RENAMED
|
@@ -274,33 +274,24 @@ class TrainingMixin:
|
|
|
274
274
|
assert self.model_version, "You must create the model version and upload its archive before validating it."
|
|
275
275
|
try:
|
|
276
276
|
self.model_version = self.request(
|
|
277
|
-
"
|
|
277
|
+
"PartialUpdateModelVersion",
|
|
278
278
|
id=self.model_version["id"],
|
|
279
279
|
body={
|
|
280
|
+
"state": "available",
|
|
280
281
|
"size": size,
|
|
281
282
|
"hash": hash,
|
|
282
283
|
"archive_hash": archive_hash,
|
|
283
284
|
},
|
|
284
285
|
)
|
|
285
286
|
except ErrorResponse as e:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if e.status_code in [403, 500]:
|
|
289
|
-
logger.warning(
|
|
290
|
-
f'An error occurred while validating model version {self.model_version["id"]}, please check its status.'
|
|
291
|
-
)
|
|
292
|
-
return
|
|
293
|
-
|
|
294
|
-
if e.status_code != 409:
|
|
287
|
+
model_version = e.content
|
|
288
|
+
if not model_version or "id" not in model_version:
|
|
295
289
|
raise e
|
|
296
290
|
|
|
297
291
|
logger.warning(
|
|
298
292
|
f"An available model version exists with hash {hash}, using it instead of the pending version."
|
|
299
293
|
)
|
|
300
294
|
pending_version_id = self.model_version["id"]
|
|
301
|
-
self.model_version = getattr(e, "content", None)
|
|
302
|
-
assert self.model_version is not None, "An unexpected error occurred."
|
|
303
|
-
|
|
304
295
|
logger.warning("Removing the pending model version.")
|
|
305
296
|
try:
|
|
306
297
|
self.request("DestroyModelVersion", id=pending_version_id)
|
|
@@ -310,4 +301,16 @@ class TrainingMixin:
|
|
|
310
301
|
f"An error occurred removing the pending version {pending_version_id}: {msg}."
|
|
311
302
|
)
|
|
312
303
|
|
|
304
|
+
logger.info("Retrieving the existing model version.")
|
|
305
|
+
existing_version_id = model_version["id"].pop()
|
|
306
|
+
try:
|
|
307
|
+
self.model_version = self.request(
|
|
308
|
+
"RetrieveModelVersion", id=existing_version_id
|
|
309
|
+
)
|
|
310
|
+
except ErrorResponse as e:
|
|
311
|
+
logger.error(
|
|
312
|
+
f"An error occurred retrieving the existing version {existing_version_id}: {e.status_code} - {e.content}."
|
|
313
|
+
)
|
|
314
|
+
raise
|
|
315
|
+
|
|
313
316
|
logger.info(f"Model version {self.model_version['id']} is now available.")
|
|
@@ -179,44 +179,12 @@ def test_validate_model_version_not_created(mock_training_worker):
|
|
|
179
179
|
mock_training_worker.validate_model_version(hash="a", size=1, archive_hash="b")
|
|
180
180
|
|
|
181
181
|
|
|
182
|
-
@pytest.mark.parametrize("status_code", [403, 500])
|
|
183
|
-
def test_validate_model_version_catch_errors(
|
|
184
|
-
mocker, mock_training_worker, caplog, status_code
|
|
185
|
-
):
|
|
186
|
-
mocker.patch(
|
|
187
|
-
"arkindex.client.ArkindexClient.request.retry.retry", return_value=False
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
mock_training_worker.model_version = {"id": "model_version_id"}
|
|
191
|
-
args = {
|
|
192
|
-
"hash": "hash",
|
|
193
|
-
"archive_hash": "archive_hash",
|
|
194
|
-
"size": 30,
|
|
195
|
-
}
|
|
196
|
-
mock_training_worker.api_client.add_error_response(
|
|
197
|
-
"ValidateModelVersion",
|
|
198
|
-
id="model_version_id",
|
|
199
|
-
status_code=status_code,
|
|
200
|
-
body=args,
|
|
201
|
-
)
|
|
202
|
-
|
|
203
|
-
mock_training_worker.validate_model_version(**args)
|
|
204
|
-
assert mock_training_worker.model_version == {"id": "model_version_id"}
|
|
205
|
-
assert [
|
|
206
|
-
(level, message)
|
|
207
|
-
for module, level, message in caplog.record_tuples
|
|
208
|
-
if module == "arkindex_worker"
|
|
209
|
-
] == [
|
|
210
|
-
(
|
|
211
|
-
logging.WARNING,
|
|
212
|
-
"An error occurred while validating model version model_version_id, please check its status.",
|
|
213
|
-
),
|
|
214
|
-
]
|
|
215
|
-
|
|
216
|
-
|
|
217
182
|
@pytest.mark.parametrize("deletion_failed", [True, False])
|
|
218
183
|
def test_validate_model_version_hash_conflict(
|
|
219
|
-
mock_training_worker,
|
|
184
|
+
mock_training_worker,
|
|
185
|
+
default_model_version,
|
|
186
|
+
caplog,
|
|
187
|
+
deletion_failed,
|
|
220
188
|
):
|
|
221
189
|
mock_training_worker.model_version = {"id": "another_id"}
|
|
222
190
|
args = {
|
|
@@ -225,11 +193,11 @@ def test_validate_model_version_hash_conflict(
|
|
|
225
193
|
"size": 30,
|
|
226
194
|
}
|
|
227
195
|
mock_training_worker.api_client.add_error_response(
|
|
228
|
-
"
|
|
196
|
+
"PartialUpdateModelVersion",
|
|
229
197
|
id="another_id",
|
|
230
198
|
status_code=409,
|
|
231
|
-
body=args,
|
|
232
|
-
content=
|
|
199
|
+
body={"state": "available", **args},
|
|
200
|
+
content={"id": ["model_version_id"]},
|
|
233
201
|
)
|
|
234
202
|
if deletion_failed:
|
|
235
203
|
mock_training_worker.api_client.add_error_response(
|
|
@@ -244,6 +212,11 @@ def test_validate_model_version_hash_conflict(
|
|
|
244
212
|
id="another_id",
|
|
245
213
|
response="No content",
|
|
246
214
|
)
|
|
215
|
+
mock_training_worker.api_client.add_response(
|
|
216
|
+
"RetrieveModelVersion",
|
|
217
|
+
id="model_version_id",
|
|
218
|
+
response=default_model_version,
|
|
219
|
+
)
|
|
247
220
|
|
|
248
221
|
mock_training_worker.validate_model_version(**args)
|
|
249
222
|
assert mock_training_worker.model_version == default_model_version
|
|
@@ -266,6 +239,7 @@ def test_validate_model_version_hash_conflict(
|
|
|
266
239
|
),
|
|
267
240
|
(logging.WARNING, "Removing the pending model version."),
|
|
268
241
|
*error_msg,
|
|
242
|
+
(logging.INFO, "Retrieving the existing model version."),
|
|
269
243
|
(logging.INFO, "Model version model_version_id is now available."),
|
|
270
244
|
]
|
|
271
245
|
|
|
@@ -278,9 +252,9 @@ def test_validate_model_version(mock_training_worker, default_model_version, cap
|
|
|
278
252
|
"size": 30,
|
|
279
253
|
}
|
|
280
254
|
mock_training_worker.api_client.add_response(
|
|
281
|
-
"
|
|
255
|
+
"PartialUpdateModelVersion",
|
|
282
256
|
id="model_version_id",
|
|
283
|
-
body=args,
|
|
257
|
+
body={"state": "available", **args},
|
|
284
258
|
response=default_model_version,
|
|
285
259
|
)
|
|
286
260
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/__init__.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/base.py
RENAMED
|
File without changes
|
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/corpus.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/dataset.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/element.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/entity.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/image.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/metadata.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/task.py
RENAMED
|
File without changes
|
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/arkindex_worker/worker/version.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/tests/test_elements_worker/test_cli.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/worker-demo/tests/test_worker.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/worker-demo/worker_demo/__init__.py
RENAMED
|
File without changes
|
{arkindex_base_worker-0.4.0a1 → arkindex_base_worker-0.4.0a2}/worker-demo/worker_demo/worker.py
RENAMED
|
File without changes
|