Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
c1925550
Commit
c1925550
authored
Nov 05, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: Remove build statistic script
It is costly and inneficient to use.
parent
ed829025
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
75 deletions
+0
-75
setup.py
setup.py
+0
-1
slapos/monitor/build_statistic.py
slapos/monitor/build_statistic.py
+0
-74
No files found.
setup.py
View file @
c1925550
...
@@ -78,7 +78,6 @@ setup(name=name,
...
@@ -78,7 +78,6 @@ setup(name=name,
'is-process-older-than-dependency-set = slapos.promise.is_process_older_than_dependency_set:main'
,
'is-process-older-than-dependency-set = slapos.promise.is_process_older_than_dependency_set:main'
,
'killpidfromfile = slapos.systool:killpidfromfile'
,
# BBB
'killpidfromfile = slapos.systool:killpidfromfile'
,
# BBB
'monitor.bootstrap = slapos.monitor.monitor:main'
,
'monitor.bootstrap = slapos.monitor.monitor:main'
,
'monitor.statistic = slapos.monitor.build_statistic:main'
,
'monitor.genstatus = slapos.monitor.globalstate:main'
,
'monitor.genstatus = slapos.monitor.globalstate:main'
,
'monitor.configwrite = slapos.monitor.monitor_config_write:main'
,
'monitor.configwrite = slapos.monitor.monitor_config_write:main'
,
'runResiliencyUnitTestTestNode = slapos.resiliencytest:runUnitTest'
,
'runResiliencyUnitTestTestNode = slapos.resiliencytest:runUnitTest'
,
...
...
slapos/monitor/build_statistic.py
deleted
100644 → 0
View file @
ed829025
import
json
import
sys
import
glob
import
time
import
os
import
argparse
def
parseArguments
():
"""
Parse arguments for monitor statistics.
"""
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--history_folder'
,
help
=
'Path where history files are located and where stats will be generated.'
)
return
parser
def
buildStatistic
(
history_folder
):
now
=
time
.
time
()
for
p
in
glob
.
glob
(
"%s/*.history.json"
%
history_folder
):
result
=
{}
stats_list
=
[]
promise_name
=
p
.
split
(
"/"
)[
-
1
].
replace
(
".history.json"
,
""
)
stat_file_path
=
p
.
replace
(
".history.json"
,
".stats.json"
)
if
os
.
path
.
exists
(
stat_file_path
):
with
open
(
stat_file_path
)
as
f
:
stats_dict
=
json
.
load
(
f
)
f
.
close
()
else
:
stats_dict
=
{
"date"
:
now
,
"data"
:
[]}
last_date
=
None
if
stats_dict
[
"data"
]:
if
"start-date"
in
stats_dict
[
"data"
][
-
1
]:
last_date
=
stats_dict
[
"data"
][
-
1
][
"start-date"
]
else
:
last_date
=
stats_dict
[
"data"
][
-
1
][
"date"
]
with
open
(
p
)
as
f
:
j
=
json
.
load
(
f
)
j_last_date
=
j
[
'data'
][
-
1
][
"date"
]
if
last_date
==
j_last_date
:
# This file was already loaded, so skip
continue
for
entry
in
j
[
'data'
]:
day
=
entry
[
"date"
].
split
(
"T"
)[
0
]
result
.
setdefault
(
day
,
{
"ERROR"
:
0
,
"OK"
:
0
})
result
[
day
][
str
(
entry
[
"status"
])]
+=
1
f
.
close
()
for
date
,
stat
in
result
.
iteritems
():
stats_list
.
append
(
{
"status"
:
"ERROR"
if
stat
[
"ERROR"
]
>
0
else
"OK"
,
"change-time"
:
now
,
"date"
:
j_last_date
,
"message"
:
stat
})
stats_dict
[
"data"
].
extend
(
stats_list
)
with
open
(
stat_file_path
,
"w+"
)
as
f
:
f
.
write
(
json
.
dumps
(
stats_dict
))
f
.
truncate
()
f
.
close
()
def
main
():
arg_parser
=
parseArguments
()
config
=
arg_parser
.
parse_args
()
buildStatistic
(
config
.
history_folder
)
sys
.
exit
(
0
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment