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
Levin Zimmermann
slapos
Commits
286d8da6
Commit
286d8da6
authored
Aug 21, 2014
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slaprunner: listener added to supervisor. It writes the files used by /slapgridResult (*_info.json)
parent
1d3ee03a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
2 deletions
+69
-2
software/slaprunner/common.cfg
software/slaprunner/common.cfg
+11
-2
software/slaprunner/instance-runner.cfg
software/slaprunner/instance-runner.cfg
+13
-0
software/slaprunner/template/listener_slapgrid.py.in
software/slaprunner/template/listener_slapgrid.py.in
+41
-0
software/slaprunner/template/supervisord.conf.in
software/slaprunner/template/supervisord.conf.in
+4
-0
No files found.
software/slaprunner/common.cfg
View file @
286d8da6
...
@@ -44,7 +44,7 @@ mode = 0644
...
@@ -44,7 +44,7 @@ mode = 0644
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner.cfg
url = ${:_profile_base_location_}/instance-runner.cfg
output = ${buildout:directory}/template-runner.cfg.in
output = ${buildout:directory}/template-runner.cfg.in
md5sum =
0a74dc48fd5fae88b43be1e3ad844c9f
md5sum =
d0ebedcb67681a4f192f62ea019150ea
mode = 0644
mode = 0644
[template-runner-import-script]
[template-runner-import-script]
...
@@ -146,12 +146,21 @@ mode = 0644
...
@@ -146,12 +146,21 @@ mode = 0644
[template-supervisord]
[template-supervisord]
recipe = hexagonit.recipe.download
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
url = ${:_profile_base_location_}/template/${:filename}
md5sum =
dbe7751c6276afd853de9239d3b509ba
md5sum =
f1f08f789195dc62b66c45e130f4114d
location = ${buildout:parts-directory}/${:_buildout_section_name_}
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = supervisord.conf.in
filename = supervisord.conf.in
download-only = true
download-only = true
mode = 0644
mode = 0644
[template-listener-slapgrid]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
md5sum = d07b5a9c63dc21209692ee2966107a25
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = listener_slapgrid.py.in
download-only = true
mode = 0644
[eggs]
[eggs]
recipe = z3c.recipe.scripts
recipe = z3c.recipe.scripts
eggs =
eggs =
...
...
software/slaprunner/instance-runner.cfg
View file @
286d8da6
...
@@ -184,6 +184,8 @@ autorun = $${slap-parameter:autorun}
...
@@ -184,6 +184,8 @@ autorun = $${slap-parameter:autorun}
knowledge0_file = $${buildout:directory}/$${public:filename}
knowledge0_file = $${buildout:directory}/$${public:filename}
minishell_cwd_file = $${directory:etc}/.minishell-cwd
minishell_cwd_file = $${directory:etc}/.minishell-cwd
minishell_history_file = $${directory:etc}/.minishell_history
minishell_history_file = $${directory:etc}/.minishell_history
software_info_json = $${runnerdirectory:home}/software_info.json
instance_info_json = $${runnerdirectory:home}/instance_info.json
[test-runner]
[test-runner]
<= slaprunner
<= slaprunner
...
@@ -650,6 +652,17 @@ template = ${template-supervisord:location}/${template-supervisord:filename}
...
@@ -650,6 +652,17 @@ template = ${template-supervisord:location}/${template-supervisord:filename}
rendered = $${directory:etc}/supervisord.conf
rendered = $${directory:etc}/supervisord.conf
context =
context =
section supervisord supervisord
section supervisord supervisord
key listener_slapgrid listener-slapgrid-bin:rendered
[listener-slapgrid-bin]
recipe = slapos.recipe.template:jinja2
template = ${template-listener-slapgrid:location}/${template-listener-slapgrid:filename}
rendered = $${directory:bin}/listener_slapgrid.py
mode = 0744
context =
section supervisord supervisord
section slaprunner slaprunner
raw python_executable ${buildout:executable}
[supervisord-wrapper]
[supervisord-wrapper]
recipe = slapos.cookbook:wrapper
recipe = slapos.cookbook:wrapper
...
...
software/slaprunner/template/listener_slapgrid.py.in
0 → 100644
View file @
286d8da6
#!{{ python_executable }}
import datetime
import json
import sys
import xmlrpclib
from supervisor import childutils
def write_stdout(s):
sys.stdout.write(s)
sys.stdout.flush()
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def write_slapgrid_result():
server = xmlrpclib.Server("http://{{- supervisord['server'] -}}")
# Tuple of tuples containing 2 elements : process name and the path of its info file
watch_processes = (("slapgrid-sr", "{{- slaprunner['software_info_json'] -}}"),
("slapgrid-cp", "{{- slaprunner['instance_info_json'] -}}"))
for process, file in watch_processes:
info = server.supervisor.getProcessInfo(process)
result = dict()
result['last_build'] = datetime.datetime.fromtimestamp(info['stop']).strftime("%Y-%m-%d %H:%M:%S")
result['success'] = info['exitstatus']
open(file, 'w').write(json.dumps(result))
def main():
while 1:
headers, payload = writer.wait()
write_slapgrid_result()
writer.ok()
if __name__ == '__main__':
writer = childutils.EventListenerProtocol()
main()
software/slaprunner/template/supervisord.conf.in
View file @
286d8da6
...
@@ -41,3 +41,7 @@ stdout_logfile = {{ supervisord['stdout_logfile'] }}
...
@@ -41,3 +41,7 @@ stdout_logfile = {{ supervisord['stdout_logfile'] }}
stderr_logfile = {{ supervisord['stdout_logfile'] }}
stderr_logfile = {{ supervisord['stdout_logfile'] }}
directory = {{ supervisord['directory'] }}
directory = {{ supervisord['directory'] }}
environment = PATH="{{- supervisord['path'] -}}"
environment = PATH="{{- supervisord['path'] -}}"
[eventlistener:listener-slapgrid]
command = {{ listener_slapgrid }}
events = PROCESS_STATE_EXITED
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