Skip to content
Snippets Groups Projects
Commit d369e702 authored by Erik Reid's avatar Erik Reid
Browse files

tasks must be named when decorator is used

parent 372b3e55
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ logger = logging.getLogger(__name__)
def log_entry_and_exit(f):
# cf. https://stackoverflow.com/a/47663642
def _w(*args, **kwargs):
logger.debug(f'>>> {f.__name__}{args}')
try:
......@@ -75,7 +76,7 @@ class InventoryTask(Task):
super().on_failure(exc, task_id, args, kwargs, einfo)
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='snmp_refresh_interfaces')
@log_entry_and_exit
def snmp_refresh_interfaces(self, hostname, community):
value = list(snmp.get_router_snmp_indexes(hostname, community))
......@@ -83,7 +84,7 @@ def snmp_refresh_interfaces(self, hostname, community):
r.set('snmp-interfaces:' + hostname, json.dumps(value))
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='netconf_refresh_config')
@log_entry_and_exit
def netconf_refresh_config(self, hostname):
netconf_doc = juniper.load_config(hostname, InventoryTask.config["ssh"])
......@@ -92,7 +93,7 @@ def netconf_refresh_config(self, hostname):
r.set('netconf:' + hostname, netconf_str)
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='update_interfaces_to_services')
@log_entry_and_exit
def update_interfaces_to_services(self):
interface_services = defaultdict(list)
......@@ -116,7 +117,7 @@ def update_interfaces_to_services(self):
rp.execute()
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='import_unmanaged_interfaces')
@log_entry_and_exit
def import_unmanaged_interfaces(self):
......@@ -148,7 +149,7 @@ def import_unmanaged_interfaces(self):
rp.execute()
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='update_access_services')
@log_entry_and_exit
def update_access_services(self):
......@@ -177,7 +178,7 @@ def update_access_services(self):
rp.execute()
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='update_lg_routers')
@log_entry_and_exit
def update_lg_routers(self):
......@@ -194,7 +195,7 @@ def update_lg_routers(self):
rp.execute()
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='update_equipment_locations')
@log_entry_and_exit
def update_equipment_locations(self):
r = get_next_redis(InventoryTask.config)
......@@ -213,7 +214,7 @@ def update_equipment_locations(self):
rp.execute()
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='update_circuit_hierarchy')
@log_entry_and_exit
def update_circuit_hierarchy(self):
......@@ -243,7 +244,7 @@ def update_circuit_hierarchy(self):
rp.execute()
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='update_geant_lambdas')
@log_entry_and_exit
def update_geant_lambdas(self):
......@@ -262,7 +263,7 @@ def update_geant_lambdas(self):
rp.execute()
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='update_neteng_managed_device_list')
@log_entry_and_exit
def update_neteng_managed_device_list(self):
self.update_state(
......@@ -416,7 +417,7 @@ def refresh_juniper_interface_list(hostname, netconf):
rp.execute()
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='reload_router_config')
@log_entry_and_exit
def reload_router_config(self, hostname):
self.update_state(
......@@ -583,7 +584,7 @@ def _wait_for_tasks(task_ids, update_callback=lambda s: None):
time.time() - start_time))
@app.task(base=InventoryTask, bind=True)
@app.task(base=InventoryTask, bind=True, name='refresh_finalizer')
@log_entry_and_exit
def refresh_finalizer(self, pending_task_ids_json):
......@@ -621,7 +622,6 @@ def refresh_finalizer(self, pending_task_ids_json):
_update('latched current/next dbs')
@log_entry_and_exit
def _build_service_category_interface_list(update_callback=lambda s: None):
def _classify(ifc):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment