Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
brian-polling-manager
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
brian
brian-polling-manager
Commits
f4bfd281
Commit
f4bfd281
authored
3 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
POL1-492: erase sensu cache before each update
parent
8715123d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
brian_polling_manager/main.py
+4
-2
4 additions, 2 deletions
brian_polling_manager/main.py
brian_polling_manager/sensu.py
+5
-0
5 additions, 0 deletions
brian_polling_manager/sensu.py
with
9 additions
and
2 deletions
brian_polling_manager/main.py
+
4
−
2
View file @
f4bfd281
...
@@ -29,8 +29,8 @@ import click
...
@@ -29,8 +29,8 @@ import click
import
jsonschema
import
jsonschema
from
statsd
import
StatsClient
from
statsd
import
StatsClient
from
brian_polling_manager
\
from
brian_polling_manager
import
inventory
,
configuration
,
\
import
inventory
,
configuration
,
interfaces
,
gws_direct
,
gws_indirect
interfaces
,
gws_direct
,
gws_indirect
,
sensu
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -74,6 +74,8 @@ def refresh(config, force=False):
...
@@ -74,6 +74,8 @@ def refresh(config, force=False):
:param force: if True, reload inventory data even if timestamp is same
:param force: if True, reload inventory data even if timestamp is same
:return: a dict, formatted as above
:return: a dict, formatted as above
"""
"""
sensu
.
clear_cached_values
()
state
=
configuration
.
State
(
config
[
'
statedir
'
])
state
=
configuration
.
State
(
config
[
'
statedir
'
])
last
=
inventory
.
last_update_timestamp
(
config
[
'
inventory
'
])
last
=
inventory
.
last_update_timestamp
(
config
[
'
inventory
'
])
if
force
or
not
last
or
last
!=
state
.
last
:
if
force
or
not
last
or
last
!=
state
.
last
:
...
...
This diff is collapsed.
Click to expand it.
brian_polling_manager/sensu.py
+
5
−
0
View file @
f4bfd281
...
@@ -12,6 +12,11 @@ logger = logging.getLogger(__name__)
...
@@ -12,6 +12,11 @@ logger = logging.getLogger(__name__)
_cached_checks
=
None
# not using lru_cache, since params is a dict
_cached_checks
=
None
# not using lru_cache, since params is a dict
def
clear_cached_values
():
global
_cached_checks
_cached_checks
=
None
def
load_all_checks
(
params
,
namespace
=
'
default
'
):
def
load_all_checks
(
params
,
namespace
=
'
default
'
):
global
_cached_checks
global
_cached_checks
if
_cached_checks
is
not
None
:
if
_cached_checks
is
not
None
:
...
...
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