Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos
Commits
d7e9ab1c
Commit
d7e9ab1c
authored
Mar 13, 2020
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: clean up
parent
769ed5ec
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
11 deletions
+9
-11
software/monitor/buildout.hash.cfg
software/monitor/buildout.hash.cfg
+1
-1
software/monitor/script/collect_csv_dump.py
software/monitor/script/collect_csv_dump.py
+6
-7
software/monitor/test/test.py
software/monitor/test/test.py
+2
-3
No files found.
software/monitor/buildout.hash.cfg
View file @
d7e9ab1c
...
@@ -38,7 +38,7 @@ md5sum = cfcbf2002b8eff5153e2bf68ed24b720
...
@@ -38,7 +38,7 @@ md5sum = cfcbf2002b8eff5153e2bf68ed24b720
[monitor-collect-csv-dump]
[monitor-collect-csv-dump]
filename = script/collect_csv_dump.py
filename = script/collect_csv_dump.py
md5sum =
67a9d1c7173e0d99bf3a5c6eb15b2bd8
md5sum =
d3cfa1f6760e3fa64ccd64acf213bdfb
[template-surykatka-ini]
[template-surykatka-ini]
_update_hash_filename_ = surykatka.ini.jinja2
_update_hash_filename_ = surykatka.ini.jinja2
...
...
software/monitor/script/collect_csv_dump.py
View file @
d7e9ab1c
...
@@ -54,15 +54,14 @@ def parseArguments():
...
@@ -54,15 +54,14 @@ def parseArguments():
return
parser
.
parse_args
()
return
parser
.
parse_args
()
def
writeFile
(
name
,
folder
,
date_scope
,
rows
):
def
writeFile
(
name
,
folder
,
date_scope
,
rows
):
if
os
.
path
.
exists
(
folder
=
os
.
path
.
join
(
folder
,
date_scope
)
os
.
path
.
join
(
folder
,
"%s/dump_%s.csv"
%
(
date_scope
,
name
))):
f
=
os
.
path
.
join
(
folder
,
"dump_%s.csv"
%
name
)
if
os
.
path
.
exists
(
f
):
# File already exists, no reason to recreate it.
# File already exists, no reason to recreate it.
return
return
mkdir_p
(
os
.
path
.
join
(
folder
,
date_scope
),
0o755
)
mkdir_p
(
folder
,
0o755
)
file_io
=
open
(
os
.
path
.
join
(
folder
,
"%s/dump_%s.csv"
%
(
date_scope
,
name
)),
"w"
)
with
open
(
f
,
"w"
)
as
file_io
:
csv_output
=
csv
.
writer
(
file_io
)
csv
.
writer
(
file_io
).
writerows
(
rows
)
csv_output
.
writerows
(
rows
)
file_io
.
close
()
def
dump_table_into_csv
(
db
,
folder
):
def
dump_table_into_csv
(
db
,
folder
):
db
.
connect
()
db
.
connect
()
...
...
software/monitor/test/test.py
View file @
d7e9ab1c
...
@@ -65,7 +65,7 @@ class ServicesTestCase(SlapOSInstanceTestCase):
...
@@ -65,7 +65,7 @@ class ServicesTestCase(SlapOSInstanceTestCase):
self
.
assertIn
(
expected_process_name
,
process_names
)
self
.
assertIn
(
expected_process_name
,
process_names
)
class
MonitorTestMixin
(
object
)
:
class
MonitorTestMixin
:
monitor_setup_url_key
=
'monitor-setup-url'
monitor_setup_url_key
=
'monitor-setup-url'
def
test_monitor_setup
(
self
):
def
test_monitor_setup
(
self
):
...
@@ -199,7 +199,7 @@ class EdgeSlaveMixin(MonitorTestMixin):
...
@@ -199,7 +199,7 @@ class EdgeSlaveMixin(MonitorTestMixin):
set
(
set
(
glob
.
glob
(
glob
.
glob
(
os
.
path
.
join
(
self
.
bot_partition_path
,
'etc'
,
'surykatka*.ini'
))),
os
.
path
.
join
(
self
.
bot_partition_path
,
'etc'
,
'surykatka*.ini'
))),
set
([
q
[
'ini-file'
]
for
q
in
self
.
surykatka_dict
.
values
()])
{
q
[
'ini-file'
]
for
q
in
self
.
surykatka_dict
.
values
()}
)
)
for
info_dict
in
self
.
surykatka_dict
.
values
():
for
info_dict
in
self
.
surykatka_dict
.
values
():
self
.
assertEqual
(
self
.
assertEqual
(
...
@@ -247,7 +247,6 @@ class EdgeSlaveMixin(MonitorTestMixin):
...
@@ -247,7 +247,6 @@ class EdgeSlaveMixin(MonitorTestMixin):
except
subprocess
.
CalledProcessError
as
e
:
except
subprocess
.
CalledProcessError
as
e
:
self
.
fail
(
'%s failed with code %s and message %s'
%
(
self
.
fail
(
'%s failed with code %s and message %s'
%
(
info_dict
[
'status-json'
],
e
.
returncode
,
e
.
output
))
info_dict
[
'status-json'
],
e
.
returncode
,
e
.
output
))
self
.
assertTrue
(
os
.
path
.
exists
(
info_dict
[
'json-file'
]))
with
open
(
info_dict
[
'json-file'
])
as
fh
:
with
open
(
info_dict
[
'json-file'
])
as
fh
:
status_json
=
json
.
load
(
fh
)
status_json
=
json
.
load
(
fh
)
self
.
assertIn
(
'bot_status'
,
status_json
)
self
.
assertIn
(
'bot_status'
,
status_json
)
...
...
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