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
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
Kirill Smelkov
slapos.toolbox
Commits
35afff13
Commit
35afff13
authored
Aug 26, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runner: mini-library added to control supervisord processes
parent
303acb03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
slapos/runner/sup_process.py
slapos/runner/sup_process.py
+40
-0
No files found.
slapos/runner/sup_process.py
0 → 100644
View file @
35afff13
import
time
import
xmlrpclib
from
supervisor
import
childutils
# This mini-library is used to communicate with supervisord process
# It aims to replace the file "process.py"
# For the moment, we keep both for compatibility
def
isRunning
(
config
,
process
):
server
=
xmlrpclib
.
Server
(
config
[
'supervisord_server'
])
state
=
server
.
supervisor
.
getProcessInfo
(
process
)[
'state'
]
return
(
True
if
state
==
20
else
False
)
def
returnCode
(
config
,
process
):
server
=
xmlrpclib
.
Server
(
config
[
'supervisord_server'
])
code
=
server
.
supervisor
.
getProcessInfo
(
process
)[
'exitstatus'
]
return
code
def
runProcess
(
config
,
process
):
server
=
xmlrpclib
.
Server
(
config
[
'supervisord_server'
])
server
.
supervisor
.
startProcess
(
process
)
def
runProcesses
(
config
,
processes
):
server
=
xmlrpclib
.
Server
(
config
[
'supervisord_server'
])
for
proc
in
processes
:
server
.
supervisor
.
startProcess
(
proc
)
waitForProcessEnd
(
proc
)
def
waitForProcessEnd
(
config
,
process
):
server
=
xmlrpclib
.
Server
(
config
[
'supervisord_server'
])
while
True
:
state
=
server
.
supervisor
.
getProcessInfo
(
process
)[
'state'
]
if
state
==
20
:
time
.
sleep
(
5
)
return
False
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