Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
dashboardv3
inventory-provider
Commits
46822631
Commit
46822631
authored
5 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
only initialize logger once
parent
82d4302e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inventory_provider/tasks/worker.py
+2
-16
2 additions, 16 deletions
inventory_provider/tasks/worker.py
with
2 additions
and
16 deletions
inventory_provider/tasks/worker.py
+
2
−
16
View file @
46822631
...
...
@@ -27,6 +27,8 @@ FINALIZER_TIMEOUT_S = 300
environment
.
setup_logging
()
logger
=
logging
.
getLogger
(
__name__
)
class
InventoryTaskError
(
Exception
):
pass
...
...
@@ -54,7 +56,6 @@ class InventoryTask(Task):
logging
.
debug
(
"
loaded config: %r
"
%
InventoryTask
.
config
)
def
update_state
(
self
,
**
kwargs
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
json
.
dumps
(
{
'
state
'
:
kwargs
[
'
state
'
],
'
meta
'
:
str
(
kwargs
[
'
meta
'
])}
))
...
...
@@ -72,7 +73,6 @@ class InventoryTask(Task):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
snmp_refresh_interfaces
(
self
,
hostname
,
community
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> snmp_refresh_interfaces(%r, %r)
'
%
(
hostname
,
community
))
...
...
@@ -87,7 +87,6 @@ def snmp_refresh_interfaces(self, hostname, community):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
netconf_refresh_config
(
self
,
hostname
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> netconf_refresh_config(%r)
'
%
hostname
)
netconf_doc
=
juniper
.
load_config
(
hostname
,
InventoryTask
.
config
[
"
ssh
"
])
...
...
@@ -101,7 +100,6 @@ def netconf_refresh_config(self, hostname):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
update_interfaces_to_services
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> update_interfaces_to_services
'
)
interface_services
=
defaultdict
(
list
)
...
...
@@ -126,7 +124,6 @@ def update_interfaces_to_services(self):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
update_equipment_locations
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> update_equipment_locations
'
)
r
=
get_next_redis
(
InventoryTask
.
config
)
...
...
@@ -145,7 +142,6 @@ def update_equipment_locations(self):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
update_circuit_hierarchy
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> update_circuit_hierarchy
'
)
# TODO: integers are not JSON keys
...
...
@@ -176,7 +172,6 @@ def update_circuit_hierarchy(self):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
update_geant_lambdas
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> update_geant_lambdas
'
)
r
=
get_next_redis
(
InventoryTask
.
config
)
...
...
@@ -195,7 +190,6 @@ def update_geant_lambdas(self):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
update_junosspace_device_list
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> update_junosspace_device_list
'
)
self
.
update_state
(
...
...
@@ -249,7 +243,6 @@ def load_netconf_data(hostname):
def
clear_cached_classifier_responses
(
hostname
=
None
):
logger
=
logging
.
getLogger
(
__name__
)
if
hostname
:
logger
.
debug
(
'
removing cached classifier responses for %r
'
%
hostname
)
...
...
@@ -282,7 +275,6 @@ def clear_cached_classifier_responses(hostname=None):
def
_refresh_peers
(
hostname
,
key_base
,
peers
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
removing cached %s for %r
'
%
(
key_base
,
hostname
))
r
=
get_next_redis
(
InventoryTask
.
config
)
...
...
@@ -330,7 +322,6 @@ def refresh_interface_address_lookups(hostname, netconf):
def
refresh_juniper_interface_list
(
hostname
,
netconf
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
removing cached netconf-interfaces for %r
'
%
hostname
)
...
...
@@ -360,7 +351,6 @@ def refresh_juniper_interface_list(hostname, netconf):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
reload_router_config
(
self
,
hostname
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> reload_router_config
'
)
self
.
update_state
(
...
...
@@ -442,7 +432,6 @@ def reload_router_config(self, hostname):
def
_derive_router_hostnames
(
config
):
logger
=
logging
.
getLogger
(
__name__
)
r
=
get_next_redis
(
config
)
junosspace_equipment
=
set
()
for
k
in
r
.
keys
(
'
junosspace:*
'
):
...
...
@@ -487,8 +476,6 @@ def launch_refresh_cache_all(config):
:param config: config structure as defined in config.py
:return:
"""
logger
=
logging
.
getLogger
(
__name__
)
_erase_next_db
(
config
)
# first batch of subtasks: refresh cached opsdb data
...
...
@@ -551,7 +538,6 @@ def _wait_for_tasks(task_ids, update_callback=lambda s: None):
@app.task
(
base
=
InventoryTask
,
bind
=
True
)
def
refresh_finalizer
(
self
,
pending_task_ids_json
):
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'
>>> refresh_finalizer
'
)
logger
.
debug
(
'
task_ids: %r
'
%
pending_task_ids_json
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment