learning-loop-node 0.10.0__py3-none-any.whl → 0.10.2__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 learning-loop-node might be problematic. Click here for more details.
- learning_loop_node/helpers/environment_reader.py +4 -0
- learning_loop_node/loop_communication.py +9 -1
- learning_loop_node/trainer/io_helpers.py +7 -5
- {learning_loop_node-0.10.0.dist-info → learning_loop_node-0.10.2.dist-info}/METADATA +1 -1
- {learning_loop_node-0.10.0.dist-info → learning_loop_node-0.10.2.dist-info}/RECORD +6 -6
- {learning_loop_node-0.10.0.dist-info → learning_loop_node-0.10.2.dist-info}/WHEEL +0 -0
|
@@ -17,13 +17,21 @@ class LoopCommunicationException(Exception):
|
|
|
17
17
|
class LoopCommunicator():
|
|
18
18
|
def __init__(self) -> None:
|
|
19
19
|
host: str = environment_reader.host(default='learning-loop.ai')
|
|
20
|
+
ssl_cert_path = environment_reader.ssl_certificate_path()
|
|
21
|
+
if ssl_cert_path:
|
|
22
|
+
logging.info('Using SSL certificate at %s', ssl_cert_path)
|
|
23
|
+
else:
|
|
24
|
+
logging.info('No SSL certificate path set')
|
|
20
25
|
self.host: str = host
|
|
21
26
|
self.username: str = environment_reader.username()
|
|
22
27
|
self.password: str = environment_reader.password()
|
|
23
28
|
self.organization: str = environment_reader.organization() # used by mock_detector
|
|
24
29
|
self.project: str = environment_reader.project() # used by mock_detector
|
|
25
30
|
self.base_url: str = f'http{"s" if "learning-loop.ai" in host else ""}://' + host
|
|
26
|
-
|
|
31
|
+
if ssl_cert_path:
|
|
32
|
+
self.async_client = httpx.AsyncClient(base_url=self.base_url, timeout=Timeout(60.0), verify=ssl_cert_path)
|
|
33
|
+
else:
|
|
34
|
+
self.async_client = httpx.AsyncClient(base_url=self.base_url, timeout=Timeout(60.0))
|
|
27
35
|
self.async_client.cookies.clear()
|
|
28
36
|
|
|
29
37
|
logging.info(f'Loop interface initialized with base_url: {self.base_url} / user: {self.username}')
|
|
@@ -152,21 +152,23 @@ class ActiveTrainingIO:
|
|
|
152
152
|
current_json_file_index = self.load_detections_upload_file_index()
|
|
153
153
|
for i in range(current_json_file_index, num_files):
|
|
154
154
|
detections = self.load_detections(i)
|
|
155
|
-
logging.info(f'uploading detections {i}/{num_files}')
|
|
155
|
+
logging.info(f'uploading detections in file {i}/{num_files}')
|
|
156
156
|
await self._upload_detections_batched(self.context, detections)
|
|
157
157
|
self.save_detections_upload_file_index(i+1)
|
|
158
158
|
|
|
159
159
|
async def _upload_detections_batched(self, context: Context, detections: List[Detections]):
|
|
160
|
-
batch_size =
|
|
160
|
+
batch_size = 100
|
|
161
161
|
skip_detections = self.load_detection_upload_progress()
|
|
162
|
+
up_count = 0
|
|
162
163
|
for i in range(skip_detections, len(detections), batch_size):
|
|
164
|
+
up_count += 1
|
|
163
165
|
up_progress = i+batch_size
|
|
164
166
|
batch_detections = detections[i:up_progress]
|
|
165
|
-
dict_detections = [jsonable_encoder(asdict(detection)) for detection in batch_detections]
|
|
166
|
-
logging.info(f'uploading detections. File size : {len(json.dumps(dict_detections))}')
|
|
167
167
|
await self._upload_detections(context, batch_detections, up_progress)
|
|
168
168
|
skip_detections = up_progress
|
|
169
169
|
|
|
170
|
+
logging.info('uploaded %d detections', len(detections))
|
|
171
|
+
|
|
170
172
|
async def _upload_detections(self, context: Context, batch_detections: List[Detections], up_progress: int):
|
|
171
173
|
detections_json = [jsonable_encoder(asdict(detections)) for detections in batch_detections]
|
|
172
174
|
response = await self.loop_communicator.post(
|
|
@@ -177,7 +179,7 @@ class ActiveTrainingIO:
|
|
|
177
179
|
raise Exception(msg)
|
|
178
180
|
|
|
179
181
|
logging.info('successfully uploaded detections')
|
|
180
|
-
if up_progress
|
|
182
|
+
if up_progress >= len(batch_detections):
|
|
181
183
|
self.save_detection_upload_progress(0)
|
|
182
184
|
else:
|
|
183
185
|
self.save_detection_upload_progress(up_progress)
|
|
@@ -37,11 +37,11 @@ learning_loop_node/detector/tests/testing_detector.py,sha256=2DSwIYJDOG4ixOGU8Ox
|
|
|
37
37
|
learning_loop_node/examples/novelty_score_updater.py,sha256=1DRgM9lxjFV-q2JvGDDsNLz_ic_rhEZ9wc6ZdjcxwPE,2038
|
|
38
38
|
learning_loop_node/globals.py,sha256=tgw_8RYOipPV9aYlyUhYtXfUxvJKRvfUk6u-qVAtZmY,174
|
|
39
39
|
learning_loop_node/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
learning_loop_node/helpers/environment_reader.py,sha256=
|
|
40
|
+
learning_loop_node/helpers/environment_reader.py,sha256=OtCTDc0KT9r-SMygkZB_Mw-ZIJPfUZVyUzHJoDCgJP8,1658
|
|
41
41
|
learning_loop_node/helpers/gdrive_downloader.py,sha256=zeYJciTAJVRpu_eFjwgYLCpIa6hU1d71anqEBb564Rk,1145
|
|
42
42
|
learning_loop_node/helpers/log_conf.py,sha256=3yd-jaMOeD5cRIgA5w_BH2L5odf8c4-ZjD89Bdqwe44,824
|
|
43
43
|
learning_loop_node/helpers/misc.py,sha256=j4is8Rv0ttnCqF-R-wP3xwEi67OI6IBJav5Woo5lyDk,7701
|
|
44
|
-
learning_loop_node/loop_communication.py,sha256=
|
|
44
|
+
learning_loop_node/loop_communication.py,sha256=t3G6wvdRCjXxUFT2QpLdRHrSEcI7N272gAvFTVyNSuU,6534
|
|
45
45
|
learning_loop_node/node.py,sha256=jpTP3gnGxFDF7tq9H7MVfVIIHm8e7bYA5euttHNJAEg,7252
|
|
46
46
|
learning_loop_node/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
47
47
|
learning_loop_node/pytest.ini,sha256=8QdjmawLy1zAzXrJ88or1kpFDhJw0W5UOnDfGGs_igU,262
|
|
@@ -58,7 +58,7 @@ learning_loop_node/tests/test_learning_loop_node.py,sha256=4qWi1ovBzebUAbvw8ecSa
|
|
|
58
58
|
learning_loop_node/trainer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
59
|
learning_loop_node/trainer/downloader.py,sha256=qzx7zzObcFEvRVQFe8gi8KJNIapASi1_XssbspXD1Rw,1469
|
|
60
60
|
learning_loop_node/trainer/executor.py,sha256=j-1pkc_5b1Y0Bh8KiQthAK7SoOfJelr5Qi7L0p1sTxE,3933
|
|
61
|
-
learning_loop_node/trainer/io_helpers.py,sha256=
|
|
61
|
+
learning_loop_node/trainer/io_helpers.py,sha256=fyjImT1NY10gLV0KM4Ns7sRrtKFswVJU_pV9-c3IVEY,7152
|
|
62
62
|
learning_loop_node/trainer/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
63
|
learning_loop_node/trainer/rest/backdoor_controls.py,sha256=YQcG0KwxzKDNYeMtHrSwr26q__N7ty0o6Kar6CLWAd0,5869
|
|
64
64
|
learning_loop_node/trainer/rest/controls.py,sha256=XF37i2edeMHKdSXyJc4ZqaTZ38u6d3u3Sb3C-Mwyfko,934
|
|
@@ -80,6 +80,6 @@ learning_loop_node/trainer/tests/testing_trainer_logic.py,sha256=7sQ6okiOhM4IhvR
|
|
|
80
80
|
learning_loop_node/trainer/trainer_logic.py,sha256=PJxiO1chPdvpq8UTtzv_nVam9CouCswX9b1FnRwT2Tw,8411
|
|
81
81
|
learning_loop_node/trainer/trainer_logic_generic.py,sha256=KFDuxgzrGITHQaJoGvhjHxWzhbb4Q7HBxSpks4CeGBg,24801
|
|
82
82
|
learning_loop_node/trainer/trainer_node.py,sha256=bcyOMeLXrLuLgsPqS8lwEOSZ6vCjGLgT0pLXgaylI1Q,4155
|
|
83
|
-
learning_loop_node-0.10.
|
|
84
|
-
learning_loop_node-0.10.
|
|
85
|
-
learning_loop_node-0.10.
|
|
83
|
+
learning_loop_node-0.10.2.dist-info/METADATA,sha256=CHv6dBGvmdhieoPsmN_PrzqQNi26OoVJoRW29thMGNc,9158
|
|
84
|
+
learning_loop_node-0.10.2.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
|
|
85
|
+
learning_loop_node-0.10.2.dist-info/RECORD,,
|
|
File without changes
|