naeural-client 2.0.3__py3-none-any.whl → 2.1.1__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.
- naeural_client/__init__.py +2 -0
- naeural_client/_ver.py +1 -1
- naeural_client/base/generic_session.py +87 -3
- naeural_client/base/instance.py +39 -0
- naeural_client/base/pipeline.py +3 -0
- naeural_client/code_cheker/base.py +74 -4
- naeural_client/const/__init__.py +1 -0
- naeural_client/const/apps.py +11 -0
- naeural_client/const/environment.py +2 -0
- naeural_client/default/instance/__init__.py +12 -0
- naeural_client/default/instance/basic_telegram_bot_01_plugin.py +7 -0
- naeural_client/default/instance/chain_dist_custom_job_01_plugin.py +2 -1
- naeural_client/default/instance/custom_web_app_01_plugin.py +6 -9
- naeural_client/default/instance/net_mon_01_plugin.py +2 -2
- naeural_client/default/instance/view_scene_01_plugin.py +2 -2
- naeural_client/logging/base_logger.py +5 -4
- {naeural_client-2.0.3.dist-info → naeural_client-2.1.1.dist-info}/METADATA +1 -2
- {naeural_client-2.0.3.dist-info → naeural_client-2.1.1.dist-info}/RECORD +20 -18
- {naeural_client-2.0.3.dist-info → naeural_client-2.1.1.dist-info}/WHEEL +1 -1
- {naeural_client-2.0.3.dist-info → naeural_client-2.1.1.dist-info}/licenses/LICENSE +0 -0
naeural_client/__init__.py
CHANGED
@@ -11,3 +11,5 @@ from .base_decentra_object import BaseDecentrAIObject
|
|
11
11
|
from .plugins_manager_mixin import _PluginsManagerMixin
|
12
12
|
from .logging import Logger
|
13
13
|
from .code_cheker import BaseCodeChecker
|
14
|
+
from .const import PLUGIN_SIGNATURES
|
15
|
+
from .default.instance import PLUGIN_TYPES
|
naeural_client/_ver.py
CHANGED
@@ -9,7 +9,7 @@ from time import time as tm
|
|
9
9
|
|
10
10
|
from ..base_decentra_object import BaseDecentrAIObject
|
11
11
|
from ..bc import DefaultBlockEngine
|
12
|
-
from ..const import COMMANDS, ENVIRONMENT, HB, PAYLOAD_DATA, STATUS_TYPE
|
12
|
+
from ..const import COMMANDS, ENVIRONMENT, HB, PAYLOAD_DATA, STATUS_TYPE, PLUGIN_SIGNATURES
|
13
13
|
from ..const import comms as comm_ct
|
14
14
|
from ..io_formatter import IOFormatterWrapper
|
15
15
|
from ..logging import Logger
|
@@ -1396,7 +1396,7 @@ class GenericSession(BaseDecentrAIObject):
|
|
1396
1396
|
def create_or_attach_to_pipeline(self, *,
|
1397
1397
|
node,
|
1398
1398
|
name,
|
1399
|
-
data_source,
|
1399
|
+
data_source="Void",
|
1400
1400
|
config={},
|
1401
1401
|
plugins=[],
|
1402
1402
|
on_data=None,
|
@@ -1410,15 +1410,21 @@ class GenericSession(BaseDecentrAIObject):
|
|
1410
1410
|
----------
|
1411
1411
|
node : str
|
1412
1412
|
Address or Name of the Naeural Edge Protocol edge node that will handle this pipeline.
|
1413
|
+
|
1413
1414
|
name : str
|
1414
1415
|
Name of the pipeline. This is good to be kept unique, as it allows multiple parties to overwrite each others configurations.
|
1416
|
+
|
1415
1417
|
data_source : str
|
1416
1418
|
This is the name of the DCT plugin, which resembles the desired functionality of the acquisition.
|
1419
|
+
Defaults to "Void" - no actual data acquisition.
|
1420
|
+
|
1417
1421
|
config : dict, optional
|
1418
1422
|
This is the dictionary that contains the configuration of the acquisition source, by default {}
|
1423
|
+
|
1419
1424
|
plugins : list
|
1420
1425
|
List of dictionaries which contain the configurations of each plugin instance that is desired to run on the box.
|
1421
1426
|
Defaults to []. Should be left [], and instances should be created with the api.
|
1427
|
+
|
1422
1428
|
on_data : Callable[[Pipeline, str, str, dict], None], optional
|
1423
1429
|
Callback that handles messages received from any plugin instance.
|
1424
1430
|
As arguments, it has a reference to this Pipeline object, the signature and the instance of the plugin
|
@@ -1426,15 +1432,18 @@ class GenericSession(BaseDecentrAIObject):
|
|
1426
1432
|
This callback acts as a default payload processor and will be called even if for a given instance
|
1427
1433
|
the user has defined a specific callback.
|
1428
1434
|
Defaults to None.
|
1435
|
+
|
1429
1436
|
on_notification : Callable[[Pipeline, dict], None], optional
|
1430
1437
|
Callback that handles notifications received from any plugin instance.
|
1431
1438
|
As arguments, it has a reference to this Pipeline object, along with the payload itself.
|
1432
1439
|
This callback acts as a default payload processor and will be called even if for a given instance
|
1433
1440
|
the user has defined a specific callback.
|
1434
1441
|
Defaults to None.
|
1442
|
+
|
1435
1443
|
max_wait_time : int, optional
|
1436
1444
|
The maximum time to busy-wait, allowing the Session object to listen to node heartbeats
|
1437
1445
|
and to check if the desired node is online in the network, by default 0.
|
1446
|
+
|
1438
1447
|
**kwargs :
|
1439
1448
|
The user can provide the configuration of the acquisition source directly as kwargs.
|
1440
1449
|
|
@@ -1651,15 +1660,39 @@ class GenericSession(BaseDecentrAIObject):
|
|
1651
1660
|
*,
|
1652
1661
|
node,
|
1653
1662
|
name,
|
1654
|
-
signature=
|
1663
|
+
signature=PLUGIN_SIGNATURES.CUSTOM_WEB_APP_01,
|
1655
1664
|
endpoints=None,
|
1656
1665
|
use_ngrok=True,
|
1657
1666
|
**kwargs
|
1658
1667
|
):
|
1668
|
+
"""
|
1669
|
+
Create a new web app on a node.
|
1670
|
+
|
1671
|
+
Parameters
|
1672
|
+
----------
|
1673
|
+
|
1674
|
+
node : str
|
1675
|
+
Address or Name of the Naeural Edge Protocol edge node that will handle this web app.
|
1676
|
+
|
1677
|
+
name : str
|
1678
|
+
Name of the web app.
|
1679
|
+
|
1680
|
+
signature : str, optional
|
1681
|
+
The signature of the plugin that will be used. Defaults to PLUGIN_SIGNATURES.CUSTOM_WEB_APP_01.
|
1682
|
+
|
1683
|
+
endpoints : list[dict], optional
|
1684
|
+
A list of dictionaries defining the endpoint configuration. Defaults to None.
|
1685
|
+
|
1686
|
+
use_ngrok : bool, optional
|
1687
|
+
If True, will use ngrok to expose the web app. Defaults to True.
|
1688
|
+
|
1689
|
+
|
1690
|
+
"""
|
1659
1691
|
|
1660
1692
|
pipeline: Pipeline = self.create_pipeline(
|
1661
1693
|
node=node,
|
1662
1694
|
name=name,
|
1695
|
+
# default TYPE is "Void"
|
1663
1696
|
)
|
1664
1697
|
|
1665
1698
|
instance = pipeline.create_plugin_instance(
|
@@ -1677,6 +1710,50 @@ class GenericSession(BaseDecentrAIObject):
|
|
1677
1710
|
# end if we have endpoints defined in the call
|
1678
1711
|
|
1679
1712
|
return pipeline, instance
|
1713
|
+
|
1714
|
+
|
1715
|
+
def create_telegram_simple_bot(
|
1716
|
+
self,
|
1717
|
+
*,
|
1718
|
+
node,
|
1719
|
+
name,
|
1720
|
+
signature=PLUGIN_SIGNATURES.CUSTOM_WEB_APP_01,
|
1721
|
+
message_handler=None,
|
1722
|
+
telegram_bot_token=None,
|
1723
|
+
telegram_bot_token_env_key=ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY,
|
1724
|
+
**kwargs
|
1725
|
+
):
|
1726
|
+
|
1727
|
+
assert callable(message_handler), "The `message_handler` method parameter must be provided."
|
1728
|
+
|
1729
|
+
if telegram_bot_token is None:
|
1730
|
+
telegram_bot_token = os.getenv(telegram_bot_token_env_key)
|
1731
|
+
if telegram_bot_token is None:
|
1732
|
+
message = f"Warning! No Telegram bot token provided as via env {ENVIRONMENT.TELEGRAM_BOT_TOKEN_ENV_KEY} or explicitly as `telegram_bot_token` param."
|
1733
|
+
raise ValueError(message)
|
1734
|
+
|
1735
|
+
|
1736
|
+
pipeline: Pipeline = self.create_pipeline(
|
1737
|
+
node=node,
|
1738
|
+
name=name,
|
1739
|
+
# default TYPE is "Void"
|
1740
|
+
)
|
1741
|
+
|
1742
|
+
func_name, func_args, func_base64_code = pipeline._get_method_data(message_handler)
|
1743
|
+
if len(func_args) != 2:
|
1744
|
+
raise ValueError("The message handler function must have exactly 2 arguments: `instance` and `data`.")
|
1745
|
+
|
1746
|
+
instance = pipeline.create_plugin_instance(
|
1747
|
+
signature=signature,
|
1748
|
+
instance_id=self.log.get_unique_id(),
|
1749
|
+
telegram_bot_token=telegram_bot_token,
|
1750
|
+
message_handler=func_base64_code,
|
1751
|
+
message_handler_args=func_args, # mandatory message and user
|
1752
|
+
message_handler_name=func_name, # not mandatory
|
1753
|
+
**kwargs
|
1754
|
+
)
|
1755
|
+
return pipeline, instance
|
1756
|
+
|
1680
1757
|
|
1681
1758
|
def broadcast_instance_command_and_wait_for_response_payload(
|
1682
1759
|
self,
|
@@ -1782,3 +1859,10 @@ class GenericSession(BaseDecentrAIObject):
|
|
1782
1859
|
# end for detach
|
1783
1860
|
|
1784
1861
|
return lst_result_payload
|
1862
|
+
|
1863
|
+
def get_client_address(self):
|
1864
|
+
return self.bc_engine.address
|
1865
|
+
|
1866
|
+
@property
|
1867
|
+
def client_address(self):
|
1868
|
+
return self.get_client_address()
|
naeural_client/base/instance.py
CHANGED
@@ -202,6 +202,7 @@ class Instance():
|
|
202
202
|
|
203
203
|
return f"<Instance: {node_addr}/{pipeline_name}/{signature}/{instance_id}>"
|
204
204
|
|
205
|
+
|
205
206
|
def _is_tainted(self):
|
206
207
|
"""
|
207
208
|
Check if the instance has a proposed configuration.
|
@@ -213,6 +214,7 @@ class Instance():
|
|
213
214
|
"""
|
214
215
|
return self.proposed_config is not None
|
215
216
|
|
217
|
+
|
216
218
|
def _get_config_dictionary(self):
|
217
219
|
"""
|
218
220
|
Get the configuration of the instance as a dictionary.
|
@@ -229,6 +231,7 @@ class Instance():
|
|
229
231
|
|
230
232
|
return config_dict
|
231
233
|
|
234
|
+
|
232
235
|
def _get_proposed_config_dictionary(self, full=False):
|
233
236
|
"""
|
234
237
|
Get the proposed configuration of the instance as a dictionary.
|
@@ -249,6 +252,7 @@ class Instance():
|
|
249
252
|
|
250
253
|
return proposed_config_dict
|
251
254
|
|
255
|
+
|
252
256
|
def _apply_staged_config(self, verbose=False):
|
253
257
|
"""
|
254
258
|
Apply the staged configuration to the instance.
|
@@ -264,6 +268,7 @@ class Instance():
|
|
264
268
|
self.__staged_config = None
|
265
269
|
return
|
266
270
|
|
271
|
+
|
267
272
|
def _discard_staged_config(self, fail_reason: str):
|
268
273
|
"""
|
269
274
|
Discard the staged configuration for the instance.
|
@@ -274,6 +279,7 @@ class Instance():
|
|
274
279
|
self.__staged_config = None
|
275
280
|
return
|
276
281
|
|
282
|
+
|
277
283
|
def _stage_proposed_config(self):
|
278
284
|
"""
|
279
285
|
Stage the proposed configuration for the instance.
|
@@ -291,6 +297,7 @@ class Instance():
|
|
291
297
|
self.__was_last_operation_successful = None
|
292
298
|
return
|
293
299
|
|
300
|
+
|
294
301
|
def _handle_instance_command_success(self):
|
295
302
|
"""
|
296
303
|
Handle the success of the instance command.
|
@@ -299,6 +306,7 @@ class Instance():
|
|
299
306
|
self.__was_last_operation_successful = True
|
300
307
|
return
|
301
308
|
|
309
|
+
|
302
310
|
def _handle_instance_command_failure(self, fail_reason: str):
|
303
311
|
"""
|
304
312
|
Handle the failure of the instance command.
|
@@ -307,6 +315,7 @@ class Instance():
|
|
307
315
|
self.__was_last_operation_successful = False
|
308
316
|
return
|
309
317
|
|
318
|
+
|
310
319
|
def __register_transaction_for_instance_command(self, session_id: str = None, timeout: float = 0) -> list[Transaction]:
|
311
320
|
"""
|
312
321
|
Register a new transaction for the instance command.
|
@@ -340,6 +349,7 @@ class Instance():
|
|
340
349
|
|
341
350
|
return transactions
|
342
351
|
|
352
|
+
|
343
353
|
def _get_instance_update_required_responses(self):
|
344
354
|
"""
|
345
355
|
Get the responses required to update the instance.
|
@@ -356,6 +366,7 @@ class Instance():
|
|
356
366
|
|
357
367
|
return responses
|
358
368
|
|
369
|
+
|
359
370
|
def _get_instance_remove_required_responses(self):
|
360
371
|
"""
|
361
372
|
Get the responses required to delete the instance.
|
@@ -371,6 +382,23 @@ class Instance():
|
|
371
382
|
|
372
383
|
return responses
|
373
384
|
|
385
|
+
def _get_method_data(self, method: callable):
|
386
|
+
"""
|
387
|
+
Get the full signature and definition of a method.
|
388
|
+
|
389
|
+
Parameters
|
390
|
+
----------
|
391
|
+
|
392
|
+
method : callable
|
393
|
+
The method to get the signature and definition for.
|
394
|
+
|
395
|
+
Returns
|
396
|
+
-------
|
397
|
+
tuple
|
398
|
+
A tuple containing the name, arguments and base64 code of the method.
|
399
|
+
"""
|
400
|
+
return self.pipeline._get_method_data(method)
|
401
|
+
|
374
402
|
# API
|
375
403
|
if True:
|
376
404
|
@property
|
@@ -399,10 +427,12 @@ class Instance():
|
|
399
427
|
"""
|
400
428
|
return self.__was_last_operation_successful
|
401
429
|
|
430
|
+
|
402
431
|
def _sync_configuration_with_remote(self, config):
|
403
432
|
self.config = {**self.config, **config}
|
404
433
|
return
|
405
434
|
|
435
|
+
|
406
436
|
def update_instance_config(self, config={}, **kwargs):
|
407
437
|
"""
|
408
438
|
Update the configuration of the instance.
|
@@ -438,6 +468,7 @@ class Instance():
|
|
438
468
|
|
439
469
|
return
|
440
470
|
|
471
|
+
|
441
472
|
def send_instance_command(self, command, payload=None, command_params=None, wait_confirmation=True, session_id=None, timeout=10):
|
442
473
|
"""
|
443
474
|
Send a command to the instance.
|
@@ -495,6 +526,7 @@ class Instance():
|
|
495
526
|
return transactions
|
496
527
|
return
|
497
528
|
|
529
|
+
|
498
530
|
def close(self):
|
499
531
|
"""
|
500
532
|
Close the instance.
|
@@ -502,20 +534,24 @@ class Instance():
|
|
502
534
|
self.pipeline.remove_plugin_instance(self)
|
503
535
|
return
|
504
536
|
|
537
|
+
|
505
538
|
def stop(self):
|
506
539
|
"""
|
507
540
|
Close the instance. Alias for `close`.
|
508
541
|
"""
|
509
542
|
self.close()
|
510
543
|
|
544
|
+
|
511
545
|
def P(self, *args, **kwargs):
|
512
546
|
self.log.P(*args, **kwargs)
|
513
547
|
return
|
514
548
|
|
549
|
+
|
515
550
|
def D(self, *args, **kwargs):
|
516
551
|
self.log.D(*args, **kwargs)
|
517
552
|
return
|
518
553
|
|
554
|
+
|
519
555
|
def temporary_attach(self, on_data=None, on_notification=None):
|
520
556
|
"""
|
521
557
|
Attach a temporary callback to the instance.
|
@@ -542,6 +578,7 @@ class Instance():
|
|
542
578
|
|
543
579
|
return attachment
|
544
580
|
|
581
|
+
|
545
582
|
def temporary_detach(self, attachment):
|
546
583
|
"""
|
547
584
|
Detach a temporary callback from the instance.
|
@@ -555,6 +592,7 @@ class Instance():
|
|
555
592
|
self._remove_temporary_on_notification_callback(attachment)
|
556
593
|
return
|
557
594
|
|
595
|
+
|
558
596
|
def convert_to_specialized_class(self, specialized_class):
|
559
597
|
"""
|
560
598
|
Convert the object to a specialized class.
|
@@ -564,6 +602,7 @@ class Instance():
|
|
564
602
|
self.__class__ = specialized_class
|
565
603
|
return self
|
566
604
|
|
605
|
+
|
567
606
|
def send_instance_command_and_wait_for_response_payload(self, command, payload=None, command_params=None, timeout_command=10, timeout_response_payload=3, response_params_key="COMMAND_PARAMS"):
|
568
607
|
"""
|
569
608
|
Send a command to the instance and wait for the response payload.
|
naeural_client/base/pipeline.py
CHANGED
@@ -664,6 +664,7 @@ class Pipeline(BaseCodeChecker):
|
|
664
664
|
|
665
665
|
return self.code_to_base64(plain_code, verbose=False)
|
666
666
|
|
667
|
+
|
667
668
|
# Message handling
|
668
669
|
if True:
|
669
670
|
def _on_data(self, signature, instance_id, data):
|
@@ -1497,3 +1498,5 @@ class Pipeline(BaseCodeChecker):
|
|
1497
1498
|
Return the node id of the pipeline.
|
1498
1499
|
"""
|
1499
1500
|
return self.session.get_node_name(self.node_addr)
|
1501
|
+
|
1502
|
+
|
@@ -428,7 +428,15 @@ class BaseCodeChecker:
|
|
428
428
|
|
429
429
|
return res
|
430
430
|
|
431
|
-
def _get_method_from_custom_code(
|
431
|
+
def _get_method_from_custom_code(
|
432
|
+
self,
|
433
|
+
str_b64code,
|
434
|
+
debug=False,
|
435
|
+
result_vars=RESULT_VARS,
|
436
|
+
self_var=None,
|
437
|
+
modify=True,
|
438
|
+
method_arguments=[]
|
439
|
+
):
|
432
440
|
exec_code__result_vars = result_vars
|
433
441
|
exec_code__debug = debug
|
434
442
|
exec_code__self_var = self_var
|
@@ -470,8 +478,9 @@ class BaseCodeChecker:
|
|
470
478
|
exec_code__errors = ["Cannot encapsulate code in method. No return statement found."]
|
471
479
|
return exec_code__result_var, exec_code__errors, exec_code__warnings
|
472
480
|
# endif can encapsulate code in method
|
473
|
-
|
474
|
-
|
481
|
+
if exec_code__debug:
|
482
|
+
self.__msg("DEBUG EXEC: Encapsulated code: \n{}".format(exec_code__code))
|
483
|
+
exec(exec_code__code) # now we execute the method definition code not the actual method
|
475
484
|
if exec_code__debug:
|
476
485
|
self.__msg("DEBUG EXEC: locals(): \n{}".format(locals()))
|
477
486
|
for _var in exec_code__result_vars:
|
@@ -521,11 +530,37 @@ class BaseCodeChecker:
|
|
521
530
|
plain_code = '\n'.join([line.rstrip()[indent:] for line in plain_code])
|
522
531
|
|
523
532
|
return plain_code
|
533
|
+
|
534
|
+
def _get_method_data(self, method: callable):
|
535
|
+
"""
|
536
|
+
Get the full signature and definition of a method.
|
537
|
+
|
538
|
+
Parameters
|
539
|
+
----------
|
540
|
+
|
541
|
+
method : callable
|
542
|
+
The method to get the signature and definition for.
|
543
|
+
|
544
|
+
Returns
|
545
|
+
-------
|
546
|
+
tuple
|
547
|
+
A tuple containing the name, arguments and base64 code of the method.
|
548
|
+
"""
|
549
|
+
import inspect
|
550
|
+
|
551
|
+
name = method.__name__
|
552
|
+
args = list(map(str, inspect.signature(method).parameters.values()))
|
553
|
+
if args[0] in ['self', 'cls', 'plugin']:
|
554
|
+
args = args[1:]
|
555
|
+
source = self.get_function_source_code(method)
|
556
|
+
base64_code = self.code_to_base64(source)
|
557
|
+
|
558
|
+
return name, args, base64_code
|
524
559
|
|
525
560
|
|
526
561
|
if __name__ == '__main__':
|
527
562
|
|
528
|
-
def some_function(x):
|
563
|
+
def some_function(plugin, x):
|
529
564
|
"""
|
530
565
|
A simple function that adds 1 to the input.
|
531
566
|
|
@@ -539,9 +574,44 @@ if __name__ == '__main__':
|
|
539
574
|
_type_
|
540
575
|
_description_
|
541
576
|
"""
|
577
|
+
print(f"Called by: {plugin}")
|
542
578
|
return x + 1
|
543
579
|
|
580
|
+
|
581
|
+
class SomeClass:
|
582
|
+
def __init__(self, eng : BaseCodeChecker, str_b64code, func_args):
|
583
|
+
self.eng : BaseCodeChecker = eng
|
584
|
+
self._func, _, _ = eng._get_method_from_custom_code(
|
585
|
+
str_b64code=str_b64code,
|
586
|
+
self_var='plugin',
|
587
|
+
method_arguments=["plugin"] + func_args,
|
588
|
+
debug=False
|
589
|
+
)
|
590
|
+
return
|
591
|
+
|
592
|
+
|
593
|
+
def my_func(self, a):
|
594
|
+
res = self._func(x=a, plugin=self)
|
595
|
+
return res
|
596
|
+
|
597
|
+
|
544
598
|
checker = BaseCodeChecker()
|
545
599
|
source_code = checker.get_function_source_code(some_function)
|
546
600
|
print("some_function:\n" + source_code)
|
601
|
+
|
602
|
+
name, args, b64code = checker._get_method_data(some_function)
|
603
|
+
print(f"Method name: {name}")
|
604
|
+
print(f"Method args: {args}")
|
605
|
+
print(f"Method code: {b64code}")
|
606
|
+
|
607
|
+
target = SomeClass(checker, str_b64code=b64code, func_args=args)
|
608
|
+
|
609
|
+
print(some_function(x=9.1, plugin=None))
|
610
|
+
print(target.my_func(9.1))
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
|
616
|
+
|
547
617
|
|
naeural_client/const/__init__.py
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
class PLUGIN_SIGNATURES:
|
2
|
+
"""
|
3
|
+
This class is used to store the plugin signatures for the different plugins.
|
4
|
+
It is complementary to the PLUGIN_TYPES class.
|
5
|
+
"""
|
6
|
+
NET_MON_01 = 'NET_MON_01'
|
7
|
+
VIEW_SCENE_01 = 'VIEW_SCENE_01'
|
8
|
+
CUSTOM_WEB_APP_01 = 'CUSTOM_CODE_FASTAPI_01'
|
9
|
+
CHAIN_DIST_CUSTOM_JOB_01 = 'PROCESS_REAL_TIME_COLLECTED_DATA_CUSTOM_EXEC_CHAIN_DIST'
|
10
|
+
BASIC_TELEGRAM_BOT_01 = 'BASIC_TELEGRAM_BOT_01'
|
11
|
+
# INSERT_NEW_PLUGIN_HERE
|
@@ -2,3 +2,15 @@ from .net_mon_01_plugin import NetMon01
|
|
2
2
|
from .view_scene_01_plugin import ViewScene01
|
3
3
|
from .custom_web_app_01_plugin import CustomWebApp01
|
4
4
|
from .chain_dist_custom_job_01_plugin import ChainDistCustomJob01
|
5
|
+
from .basic_telegram_bot_01_plugin import BasicTelegramBot01
|
6
|
+
|
7
|
+
|
8
|
+
class PLUGIN_TYPES:
|
9
|
+
"""
|
10
|
+
The plugin types that are available in the default instance
|
11
|
+
"""
|
12
|
+
NET_MON_01 = NetMon01
|
13
|
+
VIEW_SCENE_01 = ViewScene01
|
14
|
+
CUSTOM_WEB_APP_01 = CustomWebApp01
|
15
|
+
CHAIN_DIST_CUSTOM_JOB_01 = ChainDistCustomJob01
|
16
|
+
BASIC_TELEGRAM_BOT_01 = BasicTelegramBot01
|
@@ -1,8 +1,9 @@
|
|
1
1
|
from ...base import Instance
|
2
|
+
from ...const import PLUGIN_SIGNATURES
|
2
3
|
|
3
4
|
|
4
5
|
class ChainDistCustomJob01(Instance):
|
5
|
-
signature =
|
6
|
+
signature = PLUGIN_SIGNATURES.CHAIN_DIST_CUSTOM_JOB_01
|
6
7
|
|
7
8
|
def add_custom_code_callbacks(
|
8
9
|
self,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
from ...base import Instance, Pipeline
|
2
|
-
|
2
|
+
from ...const import PLUGIN_SIGNATURES
|
3
3
|
|
4
4
|
class CustomWebApp01(Instance):
|
5
|
-
signature =
|
5
|
+
signature = PLUGIN_SIGNATURES.CUSTOM_WEB_APP_01
|
6
6
|
|
7
7
|
def get_proposed_endpoints(self):
|
8
8
|
from copy import deepcopy
|
@@ -12,13 +12,10 @@ class CustomWebApp01(Instance):
|
|
12
12
|
return deepcopy(self.config.get("ENDPOINTS", []))
|
13
13
|
|
14
14
|
def get_endpoint_fields(self, method: callable):
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
base64_code = self.pipeline._get_base64_code(method)
|
20
|
-
|
21
|
-
return name, args, base64_code
|
15
|
+
"""
|
16
|
+
A aliast for get_method_data: it returns the name, args and base64 code of a method.
|
17
|
+
"""
|
18
|
+
return self._get_method_data(method)
|
22
19
|
|
23
20
|
|
24
21
|
def get_proposed_assets(self):
|
@@ -1,8 +1,8 @@
|
|
1
1
|
from ...base import Instance
|
2
|
-
|
2
|
+
from ...const import PLUGIN_SIGNATURES
|
3
3
|
|
4
4
|
class NetMon01(Instance):
|
5
|
-
signature =
|
5
|
+
signature = PLUGIN_SIGNATURES.NET_MON_01
|
6
6
|
|
7
7
|
def get_node_history(self, node_id=None, node_addr=None, time_window_hours=1, steps=20):
|
8
8
|
"""
|
@@ -180,11 +180,12 @@ class BaseLogger(object):
|
|
180
180
|
if lib_ver == "":
|
181
181
|
lib_ver = __VER__
|
182
182
|
ver = "v{}".format(lib_ver) if lib_ver != "" else ""
|
183
|
-
self.
|
184
|
-
"
|
185
|
-
|
183
|
+
self.P(
|
184
|
+
"NSDK {} initialized on [{}][{}].".format(
|
185
|
+
ver, self.MACHINE_NAME, self.get_processor_platform(),
|
186
186
|
),
|
187
|
-
color='green'
|
187
|
+
color='green',
|
188
|
+
boxed=True,
|
188
189
|
)
|
189
190
|
self.verbose_log(" Timezone: {}.".format(self.timezone),color='green')
|
190
191
|
|
@@ -1,11 +1,10 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: naeural_client
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.1.1
|
4
4
|
Summary: `naeural_client` is the Python SDK required for client app development for the Naeural Edge Protocol Edge Protocol framework
|
5
5
|
Project-URL: Homepage, https://github.com/Naeural Edge ProtocolEdgeProtocol/naeural_client
|
6
6
|
Project-URL: Bug Tracker, https://github.com/Naeural Edge ProtocolEdgeProtocol/naeural_client/issues
|
7
7
|
Author-email: Stefan Saraev <saraevstefan@gmail.com>, Andrei Ionut Damian <andrei.damian@me.com>, Cristan Bleotiu <cristibleotiu@gmail.com>
|
8
|
-
License-File: LICENSE
|
9
8
|
Classifier: License :: OSI Approved :: MIT License
|
10
9
|
Classifier: Operating System :: OS Independent
|
11
10
|
Classifier: Programming Language :: Python :: 3
|
@@ -1,12 +1,12 @@
|
|
1
|
-
naeural_client/__init__.py,sha256=
|
2
|
-
naeural_client/_ver.py,sha256=
|
1
|
+
naeural_client/__init__.py,sha256=UKEDGS0wFYyxwmhEAKJGecO2vYbIfRYUP4SQgnK10IE,578
|
2
|
+
naeural_client/_ver.py,sha256=uXJ6vSOerh941OWnXiM13FiA3hI-oi_0TjiaLu54uAQ,330
|
3
3
|
naeural_client/base_decentra_object.py,sha256=qDBpitcyhr1eEXPD8cGFtcNPNf71fqNRsmOEcCpx4sM,4180
|
4
4
|
naeural_client/plugins_manager_mixin.py,sha256=X1JdGLDz0gN1rPnTN_5mJXR8JmqoBFQISJXmPR9yvCo,11106
|
5
5
|
naeural_client/base/__init__.py,sha256=hACh83_cIv7-PwYMM3bQm2IBmNqiHw-3PAfDfAEKz9A,259
|
6
6
|
naeural_client/base/distributed_custom_code_presets.py,sha256=cvz5R88P6Z5V61Ce1vHVVh8bOkgXd6gve_vdESDNAsg,2544
|
7
|
-
naeural_client/base/generic_session.py,sha256=
|
8
|
-
naeural_client/base/instance.py,sha256=
|
9
|
-
naeural_client/base/pipeline.py,sha256=
|
7
|
+
naeural_client/base/generic_session.py,sha256=kjeLYdsq9Z8vnbCL9JA8abbFqBb-hhYsL4imRIBGPbU,69818
|
8
|
+
naeural_client/base/instance.py,sha256=kcZJmjLBtx8Bjj_ysIOx1JmLA-qSpG7E28j5rq6IYus,20444
|
9
|
+
naeural_client/base/pipeline.py,sha256=KwcPWD2XMvHotWFMpcnIycFhqiNnZuyUTUWiLU0PM5Y,57519
|
10
10
|
naeural_client/base/plugin_template.py,sha256=qGaXByd_JZFpjvH9GXNbT7KaitRxIJB6-1IhbKrZjq4,138123
|
11
11
|
naeural_client/base/responses.py,sha256=ZKBZmRhYDv8M8mQ5C_ahGsQvtWH4b9ImRcuerQdZmNw,6937
|
12
12
|
naeural_client/base/transaction.py,sha256=bfs6td5M0fINgPQNxhrl_AUjb1YiilLDQ-Cd_o3OR_E,5146
|
@@ -19,26 +19,28 @@ naeural_client/bc/ec.py,sha256=8ryEvc3__lVXSoYxd1WoTy9c8uC5Q_8R1uME7CeloIg,8578
|
|
19
19
|
naeural_client/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
naeural_client/certs/r9092118.ala.eu-central-1.emqxsl.com.crt,sha256=y-6io0tseyx9-a4Pmde1z1gPULtJNSYUpG_YFkYaMKU,1337
|
21
21
|
naeural_client/code_cheker/__init__.py,sha256=pwkdeZGVL16ZA4Qf2mRahEhoOvKhL7FyuQbMFLr1E5M,33
|
22
|
-
naeural_client/code_cheker/base.py,sha256=
|
22
|
+
naeural_client/code_cheker/base.py,sha256=toYgYFziH5x4Gqo0VedEMsANsBZAJd13mvKhRf28AQc,18907
|
23
23
|
naeural_client/code_cheker/checker.py,sha256=QWupeM7ToancVIq1tRUxRNUrI8B5l5eoY0kDU4-O5aE,7365
|
24
24
|
naeural_client/comm/__init__.py,sha256=za3B2HUKNXzYtjElMgGM9xbxNsdQfFY4JB_YzdyFkVU,76
|
25
25
|
naeural_client/comm/amqp_wrapper.py,sha256=hzj6ih07DnLQy2VSfA88giDIFHaCp9uSdGLTA-IFE4s,8535
|
26
26
|
naeural_client/comm/mqtt_wrapper.py,sha256=Ig3bFZkCbWd4y_Whn2PPa91Z3aLgNbNPau6Tn5yLPZ8,16167
|
27
27
|
naeural_client/const/README.md,sha256=6OHesr-f5NBuuJGryEoi_TCu2XdlhfQYlDKx_IJoXeg,177
|
28
|
-
naeural_client/const/__init__.py,sha256=
|
28
|
+
naeural_client/const/__init__.py,sha256=G7Fa50SpEhAPOnL8_mxgVmJ0Xq1qEncWd75pg2BkiG4,416
|
29
|
+
naeural_client/const/apps.py,sha256=i0MNCM1Wf7QUCB4OKO1vGNUonPs6EsnZV6-XZjknppw,439
|
29
30
|
naeural_client/const/base.py,sha256=V94oaT7xYrrTGxmLJlynxmbFujVX0G9wIfC8TilH5MU,2548
|
30
31
|
naeural_client/const/comms.py,sha256=La6JXWHexH8CfcBCKyT4fCIoeaoZlcm7KtZ57ab4ZgU,2201
|
31
|
-
naeural_client/const/environment.py,sha256=
|
32
|
+
naeural_client/const/environment.py,sha256=bq21Q7e5FXpTNpoek_CUOX5oOZpSJEtNHXiZ79ZHe18,753
|
32
33
|
naeural_client/const/formatter.py,sha256=AW3bWlqf39uaqV4BBUuW95qKYfF2OkkU4f9hy3kSVhM,200
|
33
34
|
naeural_client/const/heartbeat.py,sha256=jGHmKfeHTFOXJaKUT3o_ocnQyF-EpcLeunW-ifkYKfU,2534
|
34
35
|
naeural_client/const/misc.py,sha256=1ypROmZsOyp_8zG2LARwPeo-YfXuyYqZnml0elTP4kw,211
|
35
36
|
naeural_client/const/payload.py,sha256=k24vH9iJIBBPnCXx7HAEuli2fNAETK7h8ZuVKyKLgbk,5725
|
36
37
|
naeural_client/default/__init__.py,sha256=ozU6CMMuWl0LhG8Ae3LrZ65a6tLrptfscVYGf83zjxM,46
|
37
|
-
naeural_client/default/instance/__init__.py,sha256=
|
38
|
-
naeural_client/default/instance/
|
39
|
-
naeural_client/default/instance/
|
40
|
-
naeural_client/default/instance/
|
41
|
-
naeural_client/default/instance/
|
38
|
+
naeural_client/default/instance/__init__.py,sha256=pHR9_5t3xv9ug3nu-8202yW-rqq-KR3C_L5N2xaADTA,548
|
39
|
+
naeural_client/default/instance/basic_telegram_bot_01_plugin.py,sha256=4674YFg5DfGO8_bYA1Uo77duZgKYGFX1J0Xp8YzjyPM,161
|
40
|
+
naeural_client/default/instance/chain_dist_custom_job_01_plugin.py,sha256=QtHi3uXKsVs9eyMgbnvBVbMylErhV1Du4X2-7zDL7Y0,1915
|
41
|
+
naeural_client/default/instance/custom_web_app_01_plugin.py,sha256=ZDe-QXmr6KLyUx5wzA3xVrMPg8yHnWLUbGjZtB0PFgg,4785
|
42
|
+
naeural_client/default/instance/net_mon_01_plugin.py,sha256=u85i2AiYHkLJnam0wOx-m71hlp0EYyNtk3JwbkOrvHg,1208
|
43
|
+
naeural_client/default/instance/view_scene_01_plugin.py,sha256=5kMhd23kL5AYCdOJzrdCqi2ohoQNvmpv8oE6hWQtUWk,720
|
42
44
|
naeural_client/default/session/mqtt_session.py,sha256=dpQcBhhVZDo458v0IqJMZb1CsTn-TxXhYjNlyJp9Rp8,2414
|
43
45
|
naeural_client/io_formatter/__init__.py,sha256=_wy7c-Z9kgb26jN7uNTDq88G7xZ3wI_ObuQd3QWNPkQ,85
|
44
46
|
naeural_client/io_formatter/io_formatter_manager.py,sha256=MiZ70cGVD6hR99QiEk9wvJ_vADxpI-y2bTb0ITlMNI0,3451
|
@@ -49,7 +51,7 @@ naeural_client/io_formatter/default/a_dummy.py,sha256=qr9eUizQ-NN5jdXVzkaZKMaf9K
|
|
49
51
|
naeural_client/io_formatter/default/aixp1.py,sha256=MX0TeUR4APA-qN3vUC6uzcz8Pssz5lgrQWo7td5Ri1A,3052
|
50
52
|
naeural_client/io_formatter/default/default.py,sha256=gEy78cP2D5s0y8vQh4aHuxqz7D10gGfuiKF311QhrpE,494
|
51
53
|
naeural_client/logging/__init__.py,sha256=b79X45VC6c37u32flKB2GAK9f-RR0ocwP0JDCy0t7QQ,33
|
52
|
-
naeural_client/logging/base_logger.py,sha256=
|
54
|
+
naeural_client/logging/base_logger.py,sha256=tTxzCKOhcqGOtckHK8lQ1nUTNeaBNkeh0_SmDyzX6_Y,65146
|
53
55
|
naeural_client/logging/small_logger.py,sha256=6wljiHP1moCkgohRnr2EX095eM2RtdJ5B3cytbO_Ow4,2887
|
54
56
|
naeural_client/logging/logger_mixins/__init__.py,sha256=yQO7umlRvz63FeWpi-F9GRmC_MOHcNW6R6pwvZZBy3A,600
|
55
57
|
naeural_client/logging/logger_mixins/class_instance_mixin.py,sha256=xUXE2VZgmrlrSrvw0f6GF1jlTnVLeVkIiG0bhlBfq3o,2741
|
@@ -72,7 +74,7 @@ naeural_client/logging/tzlocal/windows_tz.py,sha256=Sv9okktjZJfRGGUOOppsvQuX_eXy
|
|
72
74
|
naeural_client/utils/__init__.py,sha256=mAnke3-MeRzz3nhQvhuHqLnpaaCSmDxicd7Ck9uwpmI,77
|
73
75
|
naeural_client/utils/comm_utils.py,sha256=4cS9llRr_pK_3rNgDcRMCQwYPO0kcNU7AdWy_LtMyCY,1072
|
74
76
|
naeural_client/utils/dotenv.py,sha256=_AgSo35n7EnQv5yDyu7C7i0kHragLJoCGydHjvOkrYY,2008
|
75
|
-
naeural_client-2.
|
76
|
-
naeural_client-2.
|
77
|
-
naeural_client-2.
|
78
|
-
naeural_client-2.
|
77
|
+
naeural_client-2.1.1.dist-info/METADATA,sha256=lW6p8iUe_boomUpBmtX-aNHx0k_zRquY3qpS8DecAJw,14457
|
78
|
+
naeural_client-2.1.1.dist-info/WHEEL,sha256=3U_NnUcV_1B1kPkYaPzN-irRckL5VW_lytn0ytO_kRY,87
|
79
|
+
naeural_client-2.1.1.dist-info/licenses/LICENSE,sha256=cvOsJVslde4oIaTCadabXnPqZmzcBO2f2zwXZRmJEbE,11311
|
80
|
+
naeural_client-2.1.1.dist-info/RECORD,,
|
File without changes
|