NATS wrapper for fast scanner development
Project description
NATS wrapper for BorderControl
Instruction for develop a new module.
from bc.dev.handlers import WorkerThreadHandler
counter = 0
def worker_function(data):
global counter
counter += 1
print(counter)
return {"results": [1, 2, 3, 45]}
a = WorkerThreadHandler(worker_function=worker_function, name='name', hostname='hostname')
a.run()
data - here you see all data which send in sheduler in your channel
{"results": [1, 2, 3, 45]} - module send to channel _reporter
as:
{
'task_data': data,
'result': [1, 2, 3, 45],
'name': 'name',
'hostname': 'hostname'
}
worker_function - required arg name - optional hostname - optional
Module send to channel _registration
:
{
"name": "name",
"hostname": "hostname"
}
Module must receive from channel _registration
:
{
'subjects_to_subscribe': ['test'],
'unique_name': 'test_module1'
}
If error will be detected in worker, module send error message to channel _errors
:
{
'task_data': data,
'result': "ERROR",
'name': 'name',
'hostname': 'hostname'
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for bordercontrol-0.2.0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 467ff58c124468dfdad746850d9c6678c43c1e40b0f754b0f32326dd94b9ed1a |
|
MD5 | 971729fe2bd49b0e58f2b8308cb2a278 |
|
BLAKE2b-256 | ba9f1d801a82eb4dc3ae904261c9e50ebaf9d95ae8fd0b463df8566b91a2cf70 |