proximl 0.5.9__py3-none-any.whl → 0.5.11__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.
- proximl/__init__.py +1 -1
- proximl/checkpoints.py +46 -28
- proximl/cli/cloudbender/__init__.py +2 -1
- proximl/cli/cloudbender/datastore.py +2 -7
- proximl/cli/cloudbender/service.py +19 -2
- proximl/cli/project/__init__.py +3 -72
- proximl/cli/project/data_connector.py +61 -0
- proximl/cli/project/datastore.py +61 -0
- proximl/cli/project/service.py +61 -0
- proximl/cloudbender/cloudbender.py +4 -2
- proximl/cloudbender/data_connectors.py +8 -0
- proximl/cloudbender/datastores.py +9 -19
- proximl/cloudbender/nodes.py +44 -1
- proximl/cloudbender/providers.py +53 -0
- proximl/cloudbender/regions.py +48 -0
- proximl/cloudbender/services.py +65 -1
- proximl/datasets.py +41 -12
- proximl/exceptions.py +51 -0
- proximl/jobs.py +15 -19
- proximl/models.py +41 -22
- proximl/volumes.py +24 -5
- {proximl-0.5.9.dist-info → proximl-0.5.11.dist-info}/METADATA +1 -1
- {proximl-0.5.9.dist-info → proximl-0.5.11.dist-info}/RECORD +48 -46
- tests/integration/projects/conftest.py +3 -1
- tests/integration/projects/test_projects_data_connectors_integration.py +44 -0
- tests/integration/projects/test_projects_datastores_integration.py +42 -0
- tests/integration/projects/test_projects_services_integration.py +44 -0
- tests/integration/test_checkpoints_integration.py +1 -2
- tests/integration/test_jobs_integration.py +13 -0
- tests/integration/test_models_integration.py +0 -1
- tests/unit/cli/projects/__init__.py +0 -0
- tests/unit/cli/projects/test_cli_project_data_connector_unit.py +28 -0
- tests/unit/cli/projects/test_cli_project_datastore_unit.py +26 -0
- tests/unit/cli/projects/test_cli_project_key_unit.py +26 -0
- tests/unit/cli/projects/test_cli_project_secret_unit.py +26 -0
- tests/unit/cli/projects/test_cli_project_service_unit.py +26 -0
- tests/unit/cli/projects/test_cli_project_unit.py +19 -0
- tests/unit/cloudbender/test_datastores_unit.py +1 -5
- tests/unit/cloudbender/test_services_unit.py +6 -0
- tests/unit/conftest.py +158 -15
- tests/unit/test_checkpoints_unit.py +15 -23
- tests/unit/test_datasets_unit.py +15 -20
- tests/unit/test_models_unit.py +13 -16
- tests/unit/test_volumes_unit.py +3 -0
- proximl/cli/cloudbender/reservation.py +0 -159
- proximl/cli/project.py +0 -154
- proximl/cloudbender/reservations.py +0 -126
- proximl/projects.py +0 -187
- tests/integration/test_projects_integration.py +0 -44
- tests/unit/cli/cloudbender/test_cli_reservation_unit.py +0 -38
- tests/unit/cli/test_cli_project_unit.py +0 -46
- tests/unit/cloudbender/test_reservations_unit.py +0 -173
- tests/unit/test_auth.py +0 -30
- tests/unit/test_projects_unit.py +0 -294
- tests/unit/test_proximl.py +0 -54
- {proximl-0.5.9.dist-info → proximl-0.5.11.dist-info}/LICENSE +0 -0
- {proximl-0.5.9.dist-info → proximl-0.5.11.dist-info}/WHEEL +0 -0
- {proximl-0.5.9.dist-info → proximl-0.5.11.dist-info}/entry_points.txt +0 -0
- {proximl-0.5.9.dist-info → proximl-0.5.11.dist-info}/top_level.txt +0 -0
tests/unit/conftest.py
CHANGED
|
@@ -16,16 +16,21 @@ from proximl.connections import Connections
|
|
|
16
16
|
from proximl.projects import (
|
|
17
17
|
Projects,
|
|
18
18
|
Project,
|
|
19
|
-
ProjectDatastore,
|
|
20
|
-
ProjectReservation,
|
|
21
19
|
)
|
|
20
|
+
from proximl.projects.datastores import ProjectDatastores, ProjectDatastore
|
|
21
|
+
from proximl.projects.services import ProjectServices, ProjectService
|
|
22
|
+
from proximl.projects.data_connectors import ProjectDataConnectors, ProjectDataConnector
|
|
23
|
+
from proximl.projects.keys import ProjectKeys, ProjectKey
|
|
24
|
+
from proximl.projects.secrets import ProjectSecrets, ProjectSecret
|
|
25
|
+
|
|
22
26
|
from proximl.cloudbender import Cloudbender
|
|
23
27
|
from proximl.cloudbender.providers import Provider, Providers
|
|
24
28
|
from proximl.cloudbender.regions import Region, Regions
|
|
25
29
|
from proximl.cloudbender.nodes import Node, Nodes
|
|
26
30
|
from proximl.cloudbender.devices import Device, Devices
|
|
27
31
|
from proximl.cloudbender.datastores import Datastore, Datastores
|
|
28
|
-
from proximl.cloudbender.
|
|
32
|
+
from proximl.cloudbender.services import Service, Services
|
|
33
|
+
from proximl.cloudbender.data_connectors import DataConnector, DataConnectors
|
|
29
34
|
from proximl.cloudbender.device_configs import DeviceConfig, DeviceConfigs
|
|
30
35
|
|
|
31
36
|
|
|
@@ -887,27 +892,27 @@ def mock_project_datastores():
|
|
|
887
892
|
|
|
888
893
|
|
|
889
894
|
@fixture(scope="session")
|
|
890
|
-
def
|
|
895
|
+
def mock_services():
|
|
891
896
|
proximl = Mock()
|
|
892
897
|
yield [
|
|
893
|
-
|
|
898
|
+
Service(
|
|
894
899
|
proximl,
|
|
895
900
|
**{
|
|
896
901
|
"provider_uuid": "prov-id-1",
|
|
897
902
|
"region_uuid": "reg-id-1",
|
|
898
|
-
"
|
|
903
|
+
"service_id": "res-id-1",
|
|
899
904
|
"type": "port",
|
|
900
905
|
"name": "On-Prem Service A",
|
|
901
906
|
"resource": "8001",
|
|
902
907
|
"hostname": "service-a.local",
|
|
903
908
|
},
|
|
904
909
|
),
|
|
905
|
-
|
|
910
|
+
Service(
|
|
906
911
|
proximl,
|
|
907
912
|
**{
|
|
908
913
|
"provider_uuid": "prov-id-2",
|
|
909
914
|
"region_uuid": "reg-id-2",
|
|
910
|
-
"
|
|
915
|
+
"service_id": "res-id-2",
|
|
911
916
|
"type": "port",
|
|
912
917
|
"name": "Cloud Service B",
|
|
913
918
|
"resource": "8001",
|
|
@@ -918,10 +923,10 @@ def mock_reservations():
|
|
|
918
923
|
|
|
919
924
|
|
|
920
925
|
@fixture(scope="session")
|
|
921
|
-
def
|
|
926
|
+
def mock_project_services():
|
|
922
927
|
proximl = Mock()
|
|
923
928
|
yield [
|
|
924
|
-
|
|
929
|
+
ProjectService(
|
|
925
930
|
proximl,
|
|
926
931
|
**{
|
|
927
932
|
"project_uuid": "proj-id-1",
|
|
@@ -933,7 +938,7 @@ def mock_project_reservations():
|
|
|
933
938
|
"hostname": "service-a.local",
|
|
934
939
|
},
|
|
935
940
|
),
|
|
936
|
-
|
|
941
|
+
ProjectService(
|
|
937
942
|
proximl,
|
|
938
943
|
**{
|
|
939
944
|
"project_uuid": "proj-id-1",
|
|
@@ -948,6 +953,68 @@ def mock_project_reservations():
|
|
|
948
953
|
]
|
|
949
954
|
|
|
950
955
|
|
|
956
|
+
@fixture(scope="session")
|
|
957
|
+
def mock_data_connectors():
|
|
958
|
+
proximl = Mock()
|
|
959
|
+
yield [
|
|
960
|
+
DataConnector(
|
|
961
|
+
proximl,
|
|
962
|
+
**{
|
|
963
|
+
"provider_uuid": "prov-id-1",
|
|
964
|
+
"region_uuid": "reg-id-1",
|
|
965
|
+
"connector_id": "con-id-1",
|
|
966
|
+
"type": "custom",
|
|
967
|
+
"name": "On-Prem Connection A",
|
|
968
|
+
"protocol": "TCP",
|
|
969
|
+
"port_range": "8000-8099",
|
|
970
|
+
"cidr": "10.0.3.0/24",
|
|
971
|
+
},
|
|
972
|
+
),
|
|
973
|
+
DataConnector(
|
|
974
|
+
proximl,
|
|
975
|
+
**{
|
|
976
|
+
"provider_uuid": "prov-id-2",
|
|
977
|
+
"region_uuid": "reg-id-2",
|
|
978
|
+
"connector_id": "con-id-2",
|
|
979
|
+
"type": "custom",
|
|
980
|
+
"name": "Cloud Connection B",
|
|
981
|
+
"protocol": "UDP",
|
|
982
|
+
"port_range": "5000",
|
|
983
|
+
"cidr": "10.0.2.0/24",
|
|
984
|
+
},
|
|
985
|
+
),
|
|
986
|
+
]
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
@fixture(
|
|
990
|
+
scope="session",
|
|
991
|
+
)
|
|
992
|
+
def mock_project_data_connectors():
|
|
993
|
+
proximl = Mock()
|
|
994
|
+
yield [
|
|
995
|
+
ProjectDataConnector(
|
|
996
|
+
proximl,
|
|
997
|
+
**{
|
|
998
|
+
"project_uuid": "proj-id-1",
|
|
999
|
+
"region_uuid": "reg-id-1",
|
|
1000
|
+
"id": "con-id-1",
|
|
1001
|
+
"type": "custom",
|
|
1002
|
+
"name": "On-Prem Connection A",
|
|
1003
|
+
},
|
|
1004
|
+
),
|
|
1005
|
+
ProjectDataConnector(
|
|
1006
|
+
proximl,
|
|
1007
|
+
**{
|
|
1008
|
+
"project_uuid": "proj-id-1",
|
|
1009
|
+
"region_uuid": "reg-id-2",
|
|
1010
|
+
"id": "con-id-2",
|
|
1011
|
+
"type": "custom",
|
|
1012
|
+
"name": "Cloud Connection B",
|
|
1013
|
+
},
|
|
1014
|
+
),
|
|
1015
|
+
]
|
|
1016
|
+
|
|
1017
|
+
|
|
951
1018
|
@fixture(scope="session")
|
|
952
1019
|
def mock_device_configs():
|
|
953
1020
|
proximl = Mock()
|
|
@@ -973,6 +1040,60 @@ def mock_device_configs():
|
|
|
973
1040
|
]
|
|
974
1041
|
|
|
975
1042
|
|
|
1043
|
+
@fixture(
|
|
1044
|
+
scope="session",
|
|
1045
|
+
)
|
|
1046
|
+
def mock_project_keys():
|
|
1047
|
+
proximl = Mock()
|
|
1048
|
+
yield [
|
|
1049
|
+
ProjectKey(
|
|
1050
|
+
proximl,
|
|
1051
|
+
**{
|
|
1052
|
+
"project_uuid": "proj-id-1",
|
|
1053
|
+
"type": "aws",
|
|
1054
|
+
"key_id": "AKSHFKHDFS",
|
|
1055
|
+
"updatedAt": "2023-06-02T21:22:40.084Z",
|
|
1056
|
+
},
|
|
1057
|
+
),
|
|
1058
|
+
ProjectKey(
|
|
1059
|
+
proximl,
|
|
1060
|
+
**{
|
|
1061
|
+
"project_uuid": "proj-id-1",
|
|
1062
|
+
"type": "gcp",
|
|
1063
|
+
"key_id": "credentials.json",
|
|
1064
|
+
"updatedAt": "2023-06-02T21:22:40.084Z",
|
|
1065
|
+
},
|
|
1066
|
+
),
|
|
1067
|
+
]
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
@fixture(
|
|
1071
|
+
scope="session",
|
|
1072
|
+
)
|
|
1073
|
+
def mock_project_secrets():
|
|
1074
|
+
proximl = Mock()
|
|
1075
|
+
yield [
|
|
1076
|
+
ProjectSecret(
|
|
1077
|
+
proximl,
|
|
1078
|
+
**{
|
|
1079
|
+
"project_uuid": "proj-id-1",
|
|
1080
|
+
"name": "super_secret",
|
|
1081
|
+
"created_by": "User",
|
|
1082
|
+
"updatedAt": "2023-06-02T21:22:40.084Z",
|
|
1083
|
+
},
|
|
1084
|
+
),
|
|
1085
|
+
ProjectSecret(
|
|
1086
|
+
proximl,
|
|
1087
|
+
**{
|
|
1088
|
+
"project_uuid": "proj-id-1",
|
|
1089
|
+
"name": "super_secret_2",
|
|
1090
|
+
"created_by": "User",
|
|
1091
|
+
"updatedAt": "2023-06-02T21:22:40.084Z",
|
|
1092
|
+
},
|
|
1093
|
+
),
|
|
1094
|
+
]
|
|
1095
|
+
|
|
1096
|
+
|
|
976
1097
|
@fixture(scope="function")
|
|
977
1098
|
def mock_proximl(
|
|
978
1099
|
mock_my_datasets,
|
|
@@ -990,8 +1111,14 @@ def mock_proximl(
|
|
|
990
1111
|
mock_nodes,
|
|
991
1112
|
mock_devices,
|
|
992
1113
|
mock_datastores,
|
|
993
|
-
|
|
1114
|
+
mock_services,
|
|
1115
|
+
mock_data_connectors,
|
|
994
1116
|
mock_device_configs,
|
|
1117
|
+
mock_project_datastores,
|
|
1118
|
+
mock_project_services,
|
|
1119
|
+
mock_project_data_connectors,
|
|
1120
|
+
mock_project_keys,
|
|
1121
|
+
mock_project_secrets,
|
|
995
1122
|
):
|
|
996
1123
|
proximl = create_autospec(ProxiML)
|
|
997
1124
|
proximl.active_project = "proj-id-1"
|
|
@@ -1015,6 +1142,18 @@ def mock_proximl(
|
|
|
1015
1142
|
proximl.environments.list = AsyncMock(return_value=mock_environments)
|
|
1016
1143
|
proximl.jobs.list = AsyncMock(return_value=mock_jobs)
|
|
1017
1144
|
proximl.projects.list = AsyncMock(return_value=mock_projects)
|
|
1145
|
+
proximl.projects.datastores = create_autospec(ProjectDatastores)
|
|
1146
|
+
proximl.projects.datastores.list = AsyncMock(return_value=mock_project_datastores)
|
|
1147
|
+
proximl.projects.services = create_autospec(ProjectServices)
|
|
1148
|
+
proximl.projects.services.list = AsyncMock(return_value=mock_project_services)
|
|
1149
|
+
proximl.projects.data_connectors = create_autospec(ProjectDataConnectors)
|
|
1150
|
+
proximl.projects.data_connectors.list = AsyncMock(
|
|
1151
|
+
return_value=mock_project_data_connectors
|
|
1152
|
+
)
|
|
1153
|
+
proximl.projects.keys = create_autospec(ProjectKeys)
|
|
1154
|
+
proximl.projects.keys.list = AsyncMock(return_value=mock_project_keys)
|
|
1155
|
+
proximl.projects.secrets = create_autospec(ProjectSecrets)
|
|
1156
|
+
proximl.projects.secrets.list = AsyncMock(return_value=mock_project_secrets)
|
|
1018
1157
|
|
|
1019
1158
|
proximl.cloudbender = create_autospec(Cloudbender)
|
|
1020
1159
|
|
|
@@ -1024,12 +1163,16 @@ def mock_proximl(
|
|
|
1024
1163
|
proximl.cloudbender.regions.list = AsyncMock(return_value=mock_regions)
|
|
1025
1164
|
proximl.cloudbender.nodes = create_autospec(Nodes)
|
|
1026
1165
|
proximl.cloudbender.nodes.list = AsyncMock(return_value=mock_nodes)
|
|
1027
|
-
proximl.cloudbender.devices = create_autospec(
|
|
1166
|
+
proximl.cloudbender.devices = create_autospec(Devices)
|
|
1028
1167
|
proximl.cloudbender.devices.list = AsyncMock(return_value=mock_devices)
|
|
1029
1168
|
proximl.cloudbender.datastores = create_autospec(Datastores)
|
|
1030
1169
|
proximl.cloudbender.datastores.list = AsyncMock(return_value=mock_datastores)
|
|
1031
|
-
proximl.cloudbender.
|
|
1032
|
-
proximl.cloudbender.
|
|
1170
|
+
proximl.cloudbender.services = create_autospec(Services)
|
|
1171
|
+
proximl.cloudbender.services.list = AsyncMock(return_value=mock_services)
|
|
1172
|
+
proximl.cloudbender.data_connectors = create_autospec(DataConnectors)
|
|
1173
|
+
proximl.cloudbender.data_connectors.list = AsyncMock(
|
|
1174
|
+
return_value=mock_data_connectors
|
|
1175
|
+
)
|
|
1033
1176
|
proximl.cloudbender.device_configs = create_autospec(DeviceConfigs)
|
|
1034
1177
|
proximl.cloudbender.device_configs.list = AsyncMock(
|
|
1035
1178
|
return_value=mock_device_configs
|
|
@@ -44,9 +44,7 @@ class CheckpointsTests:
|
|
|
44
44
|
api_response = dict()
|
|
45
45
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
46
46
|
await checkpoints.get("1234")
|
|
47
|
-
mock_proximl._query.assert_called_once_with(
|
|
48
|
-
"/checkpoint/1234", "GET", dict()
|
|
49
|
-
)
|
|
47
|
+
mock_proximl._query.assert_called_once_with("/checkpoint/1234", "GET", dict())
|
|
50
48
|
|
|
51
49
|
@mark.asyncio
|
|
52
50
|
async def test_list_checkpoints(
|
|
@@ -57,9 +55,7 @@ class CheckpointsTests:
|
|
|
57
55
|
api_response = dict()
|
|
58
56
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
59
57
|
await checkpoints.list()
|
|
60
|
-
mock_proximl._query.assert_called_once_with(
|
|
61
|
-
"/checkpoint", "GET", dict()
|
|
62
|
-
)
|
|
58
|
+
mock_proximl._query.assert_called_once_with("/checkpoint", "GET", dict())
|
|
63
59
|
|
|
64
60
|
@mark.asyncio
|
|
65
61
|
async def test_remove_checkpoint(
|
|
@@ -86,11 +82,13 @@ class CheckpointsTests:
|
|
|
86
82
|
name="new checkpoint",
|
|
87
83
|
source_type="aws",
|
|
88
84
|
source_uri="s3://proximl-examples/checkpoints/resnet50",
|
|
85
|
+
type="evefs",
|
|
89
86
|
)
|
|
90
87
|
api_response = {
|
|
91
88
|
"project_uuid": "cus-id-1",
|
|
92
89
|
"checkpoint_uuid": "checkpoint-id-1",
|
|
93
90
|
"name": "new checkpoint",
|
|
91
|
+
"type": "evefs",
|
|
94
92
|
"status": "new",
|
|
95
93
|
"source_type": "aws",
|
|
96
94
|
"source_uri": "s3://proximl-examples/checkpoints/resnet50",
|
|
@@ -135,7 +133,9 @@ class CheckpointTests:
|
|
|
135
133
|
|
|
136
134
|
@mark.asyncio
|
|
137
135
|
async def test_checkpoint_get_log_url(self, checkpoint, mock_proximl):
|
|
138
|
-
api_response =
|
|
136
|
+
api_response = (
|
|
137
|
+
"https://trainml-jobs-dev.s3.us-east-2.amazonaws.com/1/logs/first_one.zip"
|
|
138
|
+
)
|
|
139
139
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
140
140
|
response = await checkpoint.get_log_url()
|
|
141
141
|
mock_proximl._query.assert_called_once_with(
|
|
@@ -163,7 +163,9 @@ class CheckpointTests:
|
|
|
163
163
|
async def test_checkpoint_get_connection_utility_url(
|
|
164
164
|
self, checkpoint, mock_proximl
|
|
165
165
|
):
|
|
166
|
-
api_response =
|
|
166
|
+
api_response = (
|
|
167
|
+
"https://trainml-jobs-dev.s3.us-east-2.amazonaws.com/1/vpn/first_one.zip"
|
|
168
|
+
)
|
|
167
169
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
168
170
|
response = await checkpoint.get_connection_utility_url()
|
|
169
171
|
mock_proximl._query.assert_called_once_with(
|
|
@@ -338,9 +340,7 @@ class CheckpointTests:
|
|
|
338
340
|
assert response.id == "data-id-1"
|
|
339
341
|
|
|
340
342
|
@mark.asyncio
|
|
341
|
-
async def test_checkpoint_wait_for_successful(
|
|
342
|
-
self, checkpoint, mock_proximl
|
|
343
|
-
):
|
|
343
|
+
async def test_checkpoint_wait_for_successful(self, checkpoint, mock_proximl):
|
|
344
344
|
api_response = {
|
|
345
345
|
"customer_uuid": "cus-id-1",
|
|
346
346
|
"checkpoint_uuid": "data-id-1",
|
|
@@ -373,9 +373,7 @@ class CheckpointTests:
|
|
|
373
373
|
mock_proximl._query.assert_not_called()
|
|
374
374
|
|
|
375
375
|
@mark.asyncio
|
|
376
|
-
async def test_checkpoint_wait_for_incorrect_status(
|
|
377
|
-
self, checkpoint, mock_proximl
|
|
378
|
-
):
|
|
376
|
+
async def test_checkpoint_wait_for_incorrect_status(self, checkpoint, mock_proximl):
|
|
379
377
|
api_response = None
|
|
380
378
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
381
379
|
with raises(SpecificationError):
|
|
@@ -383,9 +381,7 @@ class CheckpointTests:
|
|
|
383
381
|
mock_proximl._query.assert_not_called()
|
|
384
382
|
|
|
385
383
|
@mark.asyncio
|
|
386
|
-
async def test_checkpoint_wait_for_with_delay(
|
|
387
|
-
self, checkpoint, mock_proximl
|
|
388
|
-
):
|
|
384
|
+
async def test_checkpoint_wait_for_with_delay(self, checkpoint, mock_proximl):
|
|
389
385
|
api_response_initial = dict(
|
|
390
386
|
checkpoint_uuid="1",
|
|
391
387
|
name="first one",
|
|
@@ -441,9 +437,7 @@ class CheckpointTests:
|
|
|
441
437
|
self, checkpoint, mock_proximl
|
|
442
438
|
):
|
|
443
439
|
mock_proximl._query = AsyncMock(
|
|
444
|
-
side_effect=ApiError(
|
|
445
|
-
404, dict(errorMessage="Checkpoint Not Found")
|
|
446
|
-
)
|
|
440
|
+
side_effect=ApiError(404, dict(errorMessage="Checkpoint Not Found"))
|
|
447
441
|
)
|
|
448
442
|
await checkpoint.wait_for("archived")
|
|
449
443
|
mock_proximl._query.assert_called()
|
|
@@ -453,9 +447,7 @@ class CheckpointTests:
|
|
|
453
447
|
self, checkpoint, mock_proximl
|
|
454
448
|
):
|
|
455
449
|
mock_proximl._query = AsyncMock(
|
|
456
|
-
side_effect=ApiError(
|
|
457
|
-
404, dict(errorMessage="Checkpoint Not Found")
|
|
458
|
-
)
|
|
450
|
+
side_effect=ApiError(404, dict(errorMessage="Checkpoint Not Found"))
|
|
459
451
|
)
|
|
460
452
|
with raises(ApiError):
|
|
461
453
|
await checkpoint.wait_for("ready")
|
tests/unit/test_datasets_unit.py
CHANGED
|
@@ -28,6 +28,7 @@ def dataset(mock_proximl):
|
|
|
28
28
|
dataset_uuid="1",
|
|
29
29
|
project_uuid="proj-id-1",
|
|
30
30
|
name="first one",
|
|
31
|
+
type="evefs",
|
|
31
32
|
status="downloading",
|
|
32
33
|
size=100000,
|
|
33
34
|
createdAt="2020-12-31T23:59:59.000Z",
|
|
@@ -103,6 +104,7 @@ class DatasetsTests:
|
|
|
103
104
|
name="new dataset",
|
|
104
105
|
source_type="aws",
|
|
105
106
|
source_uri="s3://proximl-examples/data/cifar10",
|
|
107
|
+
type="evefs",
|
|
106
108
|
)
|
|
107
109
|
api_response = {
|
|
108
110
|
"customer_uuid": "cus-id-1",
|
|
@@ -110,6 +112,7 @@ class DatasetsTests:
|
|
|
110
112
|
"dataset_uuid": "data-id-1",
|
|
111
113
|
"name": "new dataset",
|
|
112
114
|
"status": "new",
|
|
115
|
+
"type": "evefs",
|
|
113
116
|
"source_type": "aws",
|
|
114
117
|
"source_uri": "s3://proximl-examples/data/cifar10",
|
|
115
118
|
"createdAt": "2020-12-20T16:46:23.909Z",
|
|
@@ -139,9 +142,7 @@ class DatasetTests:
|
|
|
139
142
|
def test_dataset_repr(self, dataset):
|
|
140
143
|
string = repr(dataset)
|
|
141
144
|
regex = (
|
|
142
|
-
r"^Dataset\( proximl , \*\*{.*'dataset_uuid': '"
|
|
143
|
-
+ dataset.id
|
|
144
|
-
+ r"'.*}\)$"
|
|
145
|
+
r"^Dataset\( proximl , \*\*{.*'dataset_uuid': '" + dataset.id + r"'.*}\)$"
|
|
145
146
|
)
|
|
146
147
|
assert isinstance(string, str)
|
|
147
148
|
assert re.match(regex, string)
|
|
@@ -153,7 +154,9 @@ class DatasetTests:
|
|
|
153
154
|
|
|
154
155
|
@mark.asyncio
|
|
155
156
|
async def test_dataset_get_log_url(self, dataset, mock_proximl):
|
|
156
|
-
api_response =
|
|
157
|
+
api_response = (
|
|
158
|
+
"https://trainml-jobs-dev.s3.us-east-2.amazonaws.com/1/logs/first_one.zip"
|
|
159
|
+
)
|
|
157
160
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
158
161
|
response = await dataset.get_log_url()
|
|
159
162
|
mock_proximl._query.assert_called_once_with(
|
|
@@ -178,10 +181,10 @@ class DatasetTests:
|
|
|
178
181
|
assert response == api_response
|
|
179
182
|
|
|
180
183
|
@mark.asyncio
|
|
181
|
-
async def test_dataset_get_connection_utility_url(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
async def test_dataset_get_connection_utility_url(self, dataset, mock_proximl):
|
|
185
|
+
api_response = (
|
|
186
|
+
"https://trainml-jobs-dev.s3.us-east-2.amazonaws.com/1/vpn/first_one.zip"
|
|
187
|
+
)
|
|
185
188
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
186
189
|
response = await dataset.get_connection_utility_url()
|
|
187
190
|
mock_proximl._query.assert_called_once_with(
|
|
@@ -388,9 +391,7 @@ class DatasetTests:
|
|
|
388
391
|
mock_proximl._query.assert_not_called()
|
|
389
392
|
|
|
390
393
|
@mark.asyncio
|
|
391
|
-
async def test_dataset_wait_for_incorrect_status(
|
|
392
|
-
self, dataset, mock_proximl
|
|
393
|
-
):
|
|
394
|
+
async def test_dataset_wait_for_incorrect_status(self, dataset, mock_proximl):
|
|
394
395
|
api_response = None
|
|
395
396
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
396
397
|
with raises(SpecificationError):
|
|
@@ -435,9 +436,7 @@ class DatasetTests:
|
|
|
435
436
|
mock_proximl._query.assert_called()
|
|
436
437
|
|
|
437
438
|
@mark.asyncio
|
|
438
|
-
async def test_dataset_wait_for_dataset_failed(
|
|
439
|
-
self, dataset, mock_proximl
|
|
440
|
-
):
|
|
439
|
+
async def test_dataset_wait_for_dataset_failed(self, dataset, mock_proximl):
|
|
441
440
|
api_response = dict(
|
|
442
441
|
dataset_uuid="1",
|
|
443
442
|
name="first one",
|
|
@@ -450,9 +449,7 @@ class DatasetTests:
|
|
|
450
449
|
mock_proximl._query.assert_called()
|
|
451
450
|
|
|
452
451
|
@mark.asyncio
|
|
453
|
-
async def test_dataset_wait_for_archived_succeeded(
|
|
454
|
-
self, dataset, mock_proximl
|
|
455
|
-
):
|
|
452
|
+
async def test_dataset_wait_for_archived_succeeded(self, dataset, mock_proximl):
|
|
456
453
|
mock_proximl._query = AsyncMock(
|
|
457
454
|
side_effect=ApiError(404, dict(errorMessage="Dataset Not Found"))
|
|
458
455
|
)
|
|
@@ -460,9 +457,7 @@ class DatasetTests:
|
|
|
460
457
|
mock_proximl._query.assert_called()
|
|
461
458
|
|
|
462
459
|
@mark.asyncio
|
|
463
|
-
async def test_dataset_wait_for_unexpected_api_error(
|
|
464
|
-
self, dataset, mock_proximl
|
|
465
|
-
):
|
|
460
|
+
async def test_dataset_wait_for_unexpected_api_error(self, dataset, mock_proximl):
|
|
466
461
|
mock_proximl._query = AsyncMock(
|
|
467
462
|
side_effect=ApiError(404, dict(errorMessage="Dataset Not Found"))
|
|
468
463
|
)
|
tests/unit/test_models_unit.py
CHANGED
|
@@ -28,6 +28,7 @@ def model(mock_proximl):
|
|
|
28
28
|
model_uuid="1",
|
|
29
29
|
project_uuid="proj-id-1",
|
|
30
30
|
name="first one",
|
|
31
|
+
type="evefs",
|
|
31
32
|
status="downloading",
|
|
32
33
|
size=100000,
|
|
33
34
|
createdAt="2020-12-31T23:59:59.000Z",
|
|
@@ -44,9 +45,7 @@ class ModelsTests:
|
|
|
44
45
|
api_response = dict()
|
|
45
46
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
46
47
|
await models.get("1234")
|
|
47
|
-
mock_proximl._query.assert_called_once_with(
|
|
48
|
-
"/model/1234", "GET", dict()
|
|
49
|
-
)
|
|
48
|
+
mock_proximl._query.assert_called_once_with("/model/1234", "GET", dict())
|
|
50
49
|
|
|
51
50
|
@mark.asyncio
|
|
52
51
|
async def test_list_models(
|
|
@@ -84,12 +83,14 @@ class ModelsTests:
|
|
|
84
83
|
name="new model",
|
|
85
84
|
source_type="aws",
|
|
86
85
|
source_uri="s3://proximl-examples/models/resnet50",
|
|
86
|
+
type="evefs",
|
|
87
87
|
)
|
|
88
88
|
api_response = {
|
|
89
89
|
"customer_uuid": "cus-id-1",
|
|
90
90
|
"model_uuid": "model-id-1",
|
|
91
91
|
"name": "new model",
|
|
92
92
|
"status": "new",
|
|
93
|
+
"type": "evefs",
|
|
93
94
|
"source_type": "aws",
|
|
94
95
|
"source_uri": "s3://proximl-examples/models/resnet50",
|
|
95
96
|
"createdAt": "2020-12-20T16:46:23.909Z",
|
|
@@ -118,11 +119,7 @@ class ModelTests:
|
|
|
118
119
|
|
|
119
120
|
def test_model_repr(self, model):
|
|
120
121
|
string = repr(model)
|
|
121
|
-
regex = (
|
|
122
|
-
r"^Model\( proximl , \*\*{.*'model_uuid': '"
|
|
123
|
-
+ model.id
|
|
124
|
-
+ r"'.*}\)$"
|
|
125
|
-
)
|
|
122
|
+
regex = r"^Model\( proximl , \*\*{.*'model_uuid': '" + model.id + r"'.*}\)$"
|
|
126
123
|
assert isinstance(string, str)
|
|
127
124
|
assert re.match(regex, string)
|
|
128
125
|
|
|
@@ -133,7 +130,9 @@ class ModelTests:
|
|
|
133
130
|
|
|
134
131
|
@mark.asyncio
|
|
135
132
|
async def test_model_get_log_url(self, model, mock_proximl):
|
|
136
|
-
api_response =
|
|
133
|
+
api_response = (
|
|
134
|
+
"https://trainml-jobs-dev.s3.us-east-2.amazonaws.com/1/logs/first_one.zip"
|
|
135
|
+
)
|
|
137
136
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
138
137
|
response = await model.get_log_url()
|
|
139
138
|
mock_proximl._query.assert_called_once_with(
|
|
@@ -159,7 +158,9 @@ class ModelTests:
|
|
|
159
158
|
|
|
160
159
|
@mark.asyncio
|
|
161
160
|
async def test_model_get_connection_utility_url(self, model, mock_proximl):
|
|
162
|
-
api_response =
|
|
161
|
+
api_response = (
|
|
162
|
+
"https://trainml-jobs-dev.s3.us-east-2.amazonaws.com/1/vpn/first_one.zip"
|
|
163
|
+
)
|
|
163
164
|
mock_proximl._query = AsyncMock(return_value=api_response)
|
|
164
165
|
response = await model.get_connection_utility_url()
|
|
165
166
|
mock_proximl._query.assert_called_once_with(
|
|
@@ -425,9 +426,7 @@ class ModelTests:
|
|
|
425
426
|
mock_proximl._query.assert_called()
|
|
426
427
|
|
|
427
428
|
@mark.asyncio
|
|
428
|
-
async def test_model_wait_for_archived_succeeded(
|
|
429
|
-
self, model, mock_proximl
|
|
430
|
-
):
|
|
429
|
+
async def test_model_wait_for_archived_succeeded(self, model, mock_proximl):
|
|
431
430
|
mock_proximl._query = AsyncMock(
|
|
432
431
|
side_effect=ApiError(404, dict(errorMessage="Model Not Found"))
|
|
433
432
|
)
|
|
@@ -435,9 +434,7 @@ class ModelTests:
|
|
|
435
434
|
mock_proximl._query.assert_called()
|
|
436
435
|
|
|
437
436
|
@mark.asyncio
|
|
438
|
-
async def test_model_wait_for_unexpected_api_error(
|
|
439
|
-
self, model, mock_proximl
|
|
440
|
-
):
|
|
437
|
+
async def test_model_wait_for_unexpected_api_error(self, model, mock_proximl):
|
|
441
438
|
mock_proximl._query = AsyncMock(
|
|
442
439
|
side_effect=ApiError(404, dict(errorMessage="Model Not Found"))
|
|
443
440
|
)
|
tests/unit/test_volumes_unit.py
CHANGED
|
@@ -26,6 +26,7 @@ def volume(mock_proximl):
|
|
|
26
26
|
yield specimen.Volume(
|
|
27
27
|
mock_proximl,
|
|
28
28
|
id="1",
|
|
29
|
+
type="evefs",
|
|
29
30
|
project_uuid="proj-id-1",
|
|
30
31
|
name="first one",
|
|
31
32
|
status="downloading",
|
|
@@ -86,12 +87,14 @@ class VolumesTests:
|
|
|
86
87
|
source_type="aws",
|
|
87
88
|
source_uri="s3://proximl-examples/volumes/resnet50",
|
|
88
89
|
capacity="10G",
|
|
90
|
+
type="evefs",
|
|
89
91
|
)
|
|
90
92
|
api_response = {
|
|
91
93
|
"project_uuid": "cus-id-1",
|
|
92
94
|
"id": "volume-id-1",
|
|
93
95
|
"name": "new volume",
|
|
94
96
|
"status": "new",
|
|
97
|
+
"type": "evefs",
|
|
95
98
|
"source_type": "aws",
|
|
96
99
|
"capacity": "10G",
|
|
97
100
|
"source_uri": "s3://proximl-examples/volumes/resnet50",
|