mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-22 22:27:17 +00:00
chg: [sync UI] dashboard, show nb of imported items + launch/kill ail servers when a queue is subscribed/unsubscribed
This commit is contained in:
parent
0a9caf75c9
commit
b7ff905e59
2 changed files with 14 additions and 2 deletions
|
@ -22,10 +22,16 @@ sys.path.append(os.environ['AIL_BIN'])
|
||||||
# Import Project packages
|
# Import Project packages
|
||||||
##################################
|
##################################
|
||||||
from core import ail_2_ail
|
from core import ail_2_ail
|
||||||
|
from lib.ConfigLoader import ConfigLoader
|
||||||
from modules.abstract_module import AbstractModule
|
from modules.abstract_module import AbstractModule
|
||||||
from packages.Item import Item
|
from packages.Item import Item
|
||||||
from packages import Tag
|
from packages import Tag
|
||||||
|
|
||||||
|
#### CONFIG ####
|
||||||
|
config_loader = ConfigLoader()
|
||||||
|
server_cache = config_loader.get_redis_conn("Redis_Log_submit")
|
||||||
|
config_loader = None
|
||||||
|
#### ------ ####
|
||||||
|
|
||||||
class Sync_importer(AbstractModule):
|
class Sync_importer(AbstractModule):
|
||||||
"""
|
"""
|
||||||
|
@ -79,8 +85,8 @@ class Sync_importer(AbstractModule):
|
||||||
print(message)
|
print(message)
|
||||||
self.send_message_to_queue(message, 'Mixer')
|
self.send_message_to_queue(message, 'Mixer')
|
||||||
|
|
||||||
# # increase nb of paste by feeder name
|
# increase nb of item by ail sync
|
||||||
# server_cache.hincrby("mixer_cache:list_feeder", Sync, 1)
|
server_cache.hincrby("mixer_cache:list_feeder", 'AIL_Sync', 1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -945,15 +945,21 @@ def is_queue_registred_by_ail_instance(queue_uuid, ail_uuid):
|
||||||
return r_serv_sync.sismember(f'ail:instance:sync_queue:{ail_uuid}', queue_uuid)
|
return r_serv_sync.sismember(f'ail:instance:sync_queue:{ail_uuid}', queue_uuid)
|
||||||
|
|
||||||
def register_ail_to_sync_queue(ail_uuid, queue_uuid):
|
def register_ail_to_sync_queue(ail_uuid, queue_uuid):
|
||||||
|
is_linked = is_ail_instance_linked_to_sync_queue(ail_uuid)
|
||||||
r_serv_sync.sadd(f'ail2ail:sync_queue:ail_instance:{queue_uuid}', ail_uuid)
|
r_serv_sync.sadd(f'ail2ail:sync_queue:ail_instance:{queue_uuid}', ail_uuid)
|
||||||
r_serv_sync.sadd(f'ail:instance:sync_queue:{ail_uuid}', queue_uuid)
|
r_serv_sync.sadd(f'ail:instance:sync_queue:{ail_uuid}', queue_uuid)
|
||||||
set_last_updated_sync_config()
|
set_last_updated_sync_config()
|
||||||
|
if not is_linked:
|
||||||
|
refresh_ail_instance_connection(ail_uuid)
|
||||||
|
|
||||||
# # # FIXME: TODO: delete sync queue ????????????????????????????????????????????????????
|
# # # FIXME: TODO: delete sync queue ????????????????????????????????????????????????????
|
||||||
def unregister_ail_to_sync_queue(ail_uuid, queue_uuid):
|
def unregister_ail_to_sync_queue(ail_uuid, queue_uuid):
|
||||||
r_serv_sync.srem(f'ail2ail:sync_queue:ail_instance:{queue_uuid}', ail_uuid)
|
r_serv_sync.srem(f'ail2ail:sync_queue:ail_instance:{queue_uuid}', ail_uuid)
|
||||||
r_serv_sync.srem(f'ail:instance:sync_queue:{ail_uuid}', queue_uuid)
|
r_serv_sync.srem(f'ail:instance:sync_queue:{ail_uuid}', queue_uuid)
|
||||||
set_last_updated_sync_config()
|
set_last_updated_sync_config()
|
||||||
|
is_linked = is_ail_instance_linked_to_sync_queue(ail_uuid)
|
||||||
|
if not is_linked:
|
||||||
|
refresh_ail_instance_connection(ail_uuid)
|
||||||
|
|
||||||
def get_all_unregistred_queue_by_ail_instance(ail_uuid):
|
def get_all_unregistred_queue_by_ail_instance(ail_uuid):
|
||||||
return r_serv_sync.sdiff('ail2ail:sync_queue:all', f'ail:instance:sync_queue:{ail_uuid}')
|
return r_serv_sync.sdiff('ail2ail:sync_queue:all', f'ail:instance:sync_queue:{ail_uuid}')
|
||||||
|
|
Loading…
Reference in a new issue