Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Boxiang Sun
slapos.core
Commits
930cfecb
Commit
930cfecb
authored
Mar 03, 2023
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise error if any on-watch service is not running
parent
d551228a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
46 deletions
+14
-46
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+14
-43
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+0
-3
No files found.
slapos/grid/SlapObject.py
View file @
930cfecb
...
...
@@ -892,50 +892,21 @@ class Partition(object):
service_list
=
[]
if
os
.
path
.
exists
(
self
.
service_path
):
if
os
.
path
.
isdir
(
self
.
service_path
):
service_list
=
sorted
(
os
.
listdir
(
self
.
service_path
))
"""Asks supervisord to check if one of the processes are in the state_list."""
service_list
=
[]
print
(
os
.
listdir
(
self
.
service_path
))
state_list
=
[
'RUNNING'
,]
try
:
output
=
subprocess
.
check_output
([
'slapos'
,
'node'
,
'status'
])
except
Exception
as
e
:
output
=
str
(
e
.
output
)
content
=
output
.
split
(
'
\
\
n'
)
for
line
in
content
:
# print(line)
tokens
=
line
.
split
(
' '
)
# print(service_name)
if
'on-watch'
in
tokens
[
0
]:
service_name
=
tokens
[
0
].
split
(
':'
)[
1
]
# print(service_name)
service_list
.
append
(
service_name
)
bad_service_list
=
[]
for
service
in
os
.
listdir
(
self
.
service_path
):
service_list
.
append
(
service
+
'-on-watch'
)
print
(
service_list
)
for
process
in
service_list
:
with
self
.
getSupervisorRPC
()
as
supervisor
:
print
(
"Fuck!!!"
)
# info = supervisor.getProcessInfo(process_name)
print
(
info
)
if
info
[
'statename'
]
in
state_list
:
continue
# try:
# with self.getSupervisorRPC() as supervisor:
# print("Fuck!!!")
# info = supervisor.getProcessInfo(process_name)
# print(info)
# if info['statename'] in state_list:
# continue
# except xmlrpclib.Fault as exc:
# print(exc)
# if exc.faultString.startswith('BAD_NAME:'):
# self.logger.debug("BAD process name: %r" % process_name)
# print("Service name is incorrect: %r" % process_name)
# continue
# else:
# print("Service %r is not running." % process_name)
# else:
# print("All on-watch services are running.")
bad_service_list
=
[]
with
self
.
getSupervisorRPC
()
as
supervisor
:
all_process
=
supervisor
.
getAllProcessInfo
()
print
(
all_process
)
for
process
in
all_process
:
if
'on-watch'
in
process
[
'name'
]
and
process
[
'statename'
]
!=
"RUNNING"
:
self
.
logger
.
info
(
'On watch service %r is not running'
%
process
[
'name'
])
bad_service_list
.
append
(
process
[
'name'
])
if
len
(
bad_service_list
)
>
0
:
raise
ChildProcessError
(
"Some on-watch process is not running!"
)
def
cleanupFolder
(
self
,
folder_path
):
"""Delete all files and folders in a specified directory
...
...
slapos/grid/slapgrid.py
View file @
930cfecb
...
...
@@ -1292,9 +1292,6 @@ stderr_logfile_backups=1
if
not
self
.
force_stop
:
self
.
_checkPromiseList
(
local_partition
)
computer_partition
.
started
()
print
(
"******************************"
)
print
(
"******************************"
)
print
(
"******************************"
)
local_partition
.
checkOnWatchServiceStatus
()
self
.
_endInstallationTransaction
(
computer_partition
)
elif
computer_partition_state
==
COMPUTER_PARTITION_STOPPED_STATE
:
...
...
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