learning-loop-node 0.19.0__py3-none-any.whl → 0.20.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.
- learning_loop_node/trainer/trainer_logic.py +2 -10
- learning_loop_node/trainer/trainer_logic_generic.py +8 -3
- learning_loop_node/trainer/trainer_node.py +9 -0
- {learning_loop_node-0.19.0.dist-info → learning_loop_node-0.20.0.dist-info}/METADATA +1 -1
- {learning_loop_node-0.19.0.dist-info → learning_loop_node-0.20.0.dist-info}/RECORD +7 -7
- {learning_loop_node-0.19.0.dist-info → learning_loop_node-0.20.0.dist-info}/WHEEL +0 -0
- {learning_loop_node-0.19.0.dist-info → learning_loop_node-0.20.0.dist-info}/top_level.txt +0 -0
|
@@ -147,20 +147,12 @@ class TrainerLogic(TrainerLogicGeneric):
|
|
|
147
147
|
async def stop(self) -> None:
|
|
148
148
|
"""If executor is running, stop it. Else cancel training task."""
|
|
149
149
|
print('===============> stop received in trainer_logic.', flush=True)
|
|
150
|
-
|
|
151
150
|
if not self.training_active:
|
|
152
151
|
return
|
|
153
152
|
if self._executor and self._executor.is_running():
|
|
154
153
|
await self.executor.stop_and_wait()
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if self.training_task.cancel():
|
|
158
|
-
try:
|
|
159
|
-
await self.training_task
|
|
160
|
-
except asyncio.CancelledError:
|
|
161
|
-
pass
|
|
162
|
-
logging.info('cancelled training task')
|
|
163
|
-
self._may_restart()
|
|
154
|
+
return
|
|
155
|
+
await super().stop()
|
|
164
156
|
|
|
165
157
|
# ---------------------------------------- ABSTRACT METHODS ----------------------------------------
|
|
166
158
|
|
|
@@ -470,18 +470,23 @@ class TrainerLogicGeneric(ABC):
|
|
|
470
470
|
await self.stop()
|
|
471
471
|
|
|
472
472
|
async def stop(self):
|
|
473
|
-
"""
|
|
473
|
+
"""Stop the training. Default is to abort.
|
|
474
|
+
"""
|
|
475
|
+
await self.abort()
|
|
476
|
+
|
|
477
|
+
async def abort(self):
|
|
478
|
+
"""Abort the training: cancel the task immediately and discards in-progress model.
|
|
474
479
|
"""
|
|
475
480
|
if not self.training_active:
|
|
476
481
|
return
|
|
477
482
|
if self.training_task:
|
|
478
|
-
logger.info('
|
|
483
|
+
logger.info('aborting training task')
|
|
479
484
|
if self.training_task.cancel():
|
|
480
485
|
try:
|
|
481
486
|
await self.training_task
|
|
482
487
|
except asyncio.CancelledError:
|
|
483
488
|
pass
|
|
484
|
-
logger.info('
|
|
489
|
+
logger.info('aborted training task')
|
|
485
490
|
self._may_restart()
|
|
486
491
|
|
|
487
492
|
def _may_restart(self) -> None:
|
|
@@ -76,6 +76,15 @@ class TrainerNode(Node):
|
|
|
76
76
|
self.log.exception('error in stop_training. Exception:')
|
|
77
77
|
return True
|
|
78
78
|
|
|
79
|
+
@sio_client.event
|
|
80
|
+
async def abort_training():
|
|
81
|
+
self.log.info('abort_training received. Current state : %s', self.trainer_logic.state)
|
|
82
|
+
try:
|
|
83
|
+
await self.trainer_logic.abort()
|
|
84
|
+
except Exception:
|
|
85
|
+
self.log.exception('error in abort_training. Exception:')
|
|
86
|
+
return True
|
|
87
|
+
|
|
79
88
|
async def send_status(self):
|
|
80
89
|
if not self.sio_client or not self.sio_client.connected:
|
|
81
90
|
self.log.debug('cannot send status - not connected to the Learning Loop')
|
|
@@ -50,12 +50,12 @@ learning_loop_node/trainer/exceptions.py,sha256=vbuoE6kssLQuA8zd3LiDHmZglP6E2IJJ
|
|
|
50
50
|
learning_loop_node/trainer/executor.py,sha256=XQ1TwgOF2pQv7bgzSaljDWG4I1ySjYXL8r9c_p9MX1Q,3947
|
|
51
51
|
learning_loop_node/trainer/io_helpers.py,sha256=zWl0-HLP8zxOG3ybm76vXgEozULj_1QRl95jkrF126k,7255
|
|
52
52
|
learning_loop_node/trainer/test_executor.py,sha256=6BVGDN_6f5GEMMEvDLSG1yzMybSvgXaP5uYpSfsVPP0,2224
|
|
53
|
-
learning_loop_node/trainer/trainer_logic.py,sha256=
|
|
54
|
-
learning_loop_node/trainer/trainer_logic_generic.py,sha256=
|
|
55
|
-
learning_loop_node/trainer/trainer_node.py,sha256=
|
|
53
|
+
learning_loop_node/trainer/trainer_logic.py,sha256=pcVQXVICEZ0Tu6WbMtuciOCETMeQAq8SAoCj3sEF0-Y,8479
|
|
54
|
+
learning_loop_node/trainer/trainer_logic_generic.py,sha256=IRP68ZGpnOX4OS03OwB7HmTUvk6nbBRmCjMCVupGE_Q,27196
|
|
55
|
+
learning_loop_node/trainer/trainer_node.py,sha256=ZnydfHJ2ehAhb821Xke_09qthCE3vDf7iqeYUrliSSo,4938
|
|
56
56
|
learning_loop_node/trainer/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
57
|
learning_loop_node/trainer/rest/backdoor_controls.py,sha256=ZnK8ypY5r_q0-YZbtaOxhQThzuZvMsQHM5gJGESd_dE,5131
|
|
58
|
-
learning_loop_node-0.
|
|
59
|
-
learning_loop_node-0.
|
|
60
|
-
learning_loop_node-0.
|
|
61
|
-
learning_loop_node-0.
|
|
58
|
+
learning_loop_node-0.20.0.dist-info/METADATA,sha256=mrnQ8e97A5zQTk8HSj_LxVzZ9rQq711XRQteman88lw,15383
|
|
59
|
+
learning_loop_node-0.20.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
60
|
+
learning_loop_node-0.20.0.dist-info/top_level.txt,sha256=nS5qiFc4stVF_VXVCVJxZnrqVOv3IGX5-_E3sLby6OE,19
|
|
61
|
+
learning_loop_node-0.20.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|