arkindex-base-worker 0.3.7rc10__py3-none-any.whl → 0.4.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.
- {arkindex_base_worker-0.3.7rc10.dist-info → arkindex_base_worker-0.4.0.dist-info}/METADATA +16 -20
- arkindex_base_worker-0.4.0.dist-info/RECORD +61 -0
- {arkindex_base_worker-0.3.7rc10.dist-info → arkindex_base_worker-0.4.0.dist-info}/WHEEL +1 -1
- arkindex_worker/cache.py +1 -1
- arkindex_worker/image.py +120 -1
- arkindex_worker/models.py +6 -0
- arkindex_worker/utils.py +85 -4
- arkindex_worker/worker/__init__.py +68 -162
- arkindex_worker/worker/base.py +39 -34
- arkindex_worker/worker/classification.py +34 -18
- arkindex_worker/worker/corpus.py +86 -0
- arkindex_worker/worker/dataset.py +71 -1
- arkindex_worker/worker/element.py +352 -91
- arkindex_worker/worker/entity.py +11 -11
- arkindex_worker/worker/image.py +21 -0
- arkindex_worker/worker/metadata.py +19 -9
- arkindex_worker/worker/process.py +92 -0
- arkindex_worker/worker/task.py +5 -4
- arkindex_worker/worker/training.py +25 -10
- arkindex_worker/worker/transcription.py +89 -68
- arkindex_worker/worker/version.py +3 -1
- tests/__init__.py +8 -0
- tests/conftest.py +36 -52
- tests/test_base_worker.py +212 -12
- tests/test_dataset_worker.py +21 -45
- tests/test_elements_worker/{test_classifications.py → test_classification.py} +216 -100
- tests/test_elements_worker/test_cli.py +3 -11
- tests/test_elements_worker/test_corpus.py +168 -0
- tests/test_elements_worker/test_dataset.py +7 -12
- tests/test_elements_worker/test_element.py +427 -0
- tests/test_elements_worker/test_element_create_multiple.py +715 -0
- tests/test_elements_worker/test_element_create_single.py +528 -0
- tests/test_elements_worker/test_element_list_children.py +969 -0
- tests/test_elements_worker/test_element_list_parents.py +530 -0
- tests/test_elements_worker/{test_entities.py → test_entity_create.py} +37 -195
- tests/test_elements_worker/test_entity_list_and_check.py +160 -0
- tests/test_elements_worker/test_image.py +66 -0
- tests/test_elements_worker/test_metadata.py +230 -139
- tests/test_elements_worker/test_process.py +89 -0
- tests/test_elements_worker/test_task.py +8 -18
- tests/test_elements_worker/test_training.py +17 -8
- tests/test_elements_worker/test_transcription_create.py +873 -0
- tests/test_elements_worker/test_transcription_create_with_elements.py +951 -0
- tests/test_elements_worker/test_transcription_list.py +450 -0
- tests/test_elements_worker/test_version.py +60 -0
- tests/test_elements_worker/test_worker.py +563 -279
- tests/test_image.py +432 -209
- tests/test_merge.py +1 -2
- tests/test_utils.py +66 -3
- arkindex_base_worker-0.3.7rc10.dist-info/RECORD +0 -47
- tests/test_elements_worker/test_elements.py +0 -2713
- tests/test_elements_worker/test_transcriptions.py +0 -2119
- {arkindex_base_worker-0.3.7rc10.dist-info → arkindex_base_worker-0.4.0.dist-info}/LICENSE +0 -0
- {arkindex_base_worker-0.3.7rc10.dist-info → arkindex_base_worker-0.4.0.dist-info}/top_level.txt +0 -0
|
@@ -8,7 +8,7 @@ from arkindex_worker.worker import BaseWorker
|
|
|
8
8
|
from arkindex_worker.worker.training import TrainingMixin, create_archive
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
@pytest.fixture
|
|
11
|
+
@pytest.fixture
|
|
12
12
|
def mock_training_worker(monkeypatch):
|
|
13
13
|
class TrainingWorker(BaseWorker, TrainingMixin):
|
|
14
14
|
"""
|
|
@@ -22,7 +22,7 @@ def mock_training_worker(monkeypatch):
|
|
|
22
22
|
return training_worker
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
@pytest.fixture
|
|
25
|
+
@pytest.fixture
|
|
26
26
|
def default_model_version():
|
|
27
27
|
return {
|
|
28
28
|
"id": "model_version_id",
|
|
@@ -181,7 +181,10 @@ def test_validate_model_version_not_created(mock_training_worker):
|
|
|
181
181
|
|
|
182
182
|
@pytest.mark.parametrize("deletion_failed", [True, False])
|
|
183
183
|
def test_validate_model_version_hash_conflict(
|
|
184
|
-
mock_training_worker,
|
|
184
|
+
mock_training_worker,
|
|
185
|
+
default_model_version,
|
|
186
|
+
caplog,
|
|
187
|
+
deletion_failed,
|
|
185
188
|
):
|
|
186
189
|
mock_training_worker.model_version = {"id": "another_id"}
|
|
187
190
|
args = {
|
|
@@ -190,11 +193,11 @@ def test_validate_model_version_hash_conflict(
|
|
|
190
193
|
"size": 30,
|
|
191
194
|
}
|
|
192
195
|
mock_training_worker.api_client.add_error_response(
|
|
193
|
-
"
|
|
196
|
+
"PartialUpdateModelVersion",
|
|
194
197
|
id="another_id",
|
|
195
198
|
status_code=409,
|
|
196
|
-
body=args,
|
|
197
|
-
content=
|
|
199
|
+
body={"state": "available", **args},
|
|
200
|
+
content={"id": ["model_version_id"]},
|
|
198
201
|
)
|
|
199
202
|
if deletion_failed:
|
|
200
203
|
mock_training_worker.api_client.add_error_response(
|
|
@@ -209,6 +212,11 @@ def test_validate_model_version_hash_conflict(
|
|
|
209
212
|
id="another_id",
|
|
210
213
|
response="No content",
|
|
211
214
|
)
|
|
215
|
+
mock_training_worker.api_client.add_response(
|
|
216
|
+
"RetrieveModelVersion",
|
|
217
|
+
id="model_version_id",
|
|
218
|
+
response=default_model_version,
|
|
219
|
+
)
|
|
212
220
|
|
|
213
221
|
mock_training_worker.validate_model_version(**args)
|
|
214
222
|
assert mock_training_worker.model_version == default_model_version
|
|
@@ -231,6 +239,7 @@ def test_validate_model_version_hash_conflict(
|
|
|
231
239
|
),
|
|
232
240
|
(logging.WARNING, "Removing the pending model version."),
|
|
233
241
|
*error_msg,
|
|
242
|
+
(logging.INFO, "Retrieving the existing model version."),
|
|
234
243
|
(logging.INFO, "Model version model_version_id is now available."),
|
|
235
244
|
]
|
|
236
245
|
|
|
@@ -243,9 +252,9 @@ def test_validate_model_version(mock_training_worker, default_model_version, cap
|
|
|
243
252
|
"size": 30,
|
|
244
253
|
}
|
|
245
254
|
mock_training_worker.api_client.add_response(
|
|
246
|
-
"
|
|
255
|
+
"PartialUpdateModelVersion",
|
|
247
256
|
id="model_version_id",
|
|
248
|
-
body=args,
|
|
257
|
+
body={"state": "available", **args},
|
|
249
258
|
response=default_model_version,
|
|
250
259
|
)
|
|
251
260
|
|