Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
slapos
Commits
74d58ae3
Commit
74d58ae3
authored
Dec 16, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webrunner: add custom monitor script to monitor all promises of subinstances.
parent
d8f8b7f6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
3 deletions
+63
-3
software/slaprunner/common.cfg
software/slaprunner/common.cfg
+12
-3
software/slaprunner/instance-runner-export.cfg.in
software/slaprunner/instance-runner-export.cfg.in
+1
-0
software/slaprunner/instance-runner.cfg
software/slaprunner/instance-runner.cfg
+8
-0
software/slaprunner/template/monitor-check-webrunner-internal-instances.py
...er/template/monitor-check-webrunner-internal-instances.py
+42
-0
No files found.
software/slaprunner/common.cfg
View file @
74d58ae3
...
...
@@ -45,14 +45,14 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner.cfg
output = ${buildout:directory}/template-runner.cfg.in
md5sum =
ae802787e193960662a2b9e174609f
6e
md5sum =
f4a1dfe1dd52f6793c4aa7a02b1732
6e
mode = 0644
[template-runner-import-script]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/runner-import.sh.jinja2
download-only = true
md5sum =
f7594f522e7350d5394c7ae3c058154c
md5sum =
a85d054b3e2ae9243d8d188c897dc121
filename = runner-import.sh.jinja2
mode = 0644
...
...
@@ -75,7 +75,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner-export.cfg.in
output = ${buildout:directory}/instance-runner-export.cfg
md5sum =
83022e8e07ad9217b844b4e62405bed9
md5sum =
49bc44385c9da2fac0cdd559713368d5
mode = 0644
[template-resilient]
...
...
@@ -171,6 +171,15 @@ destination = ${buildout:parts-directory}/monitor-template-cors-domain-cgi
filename = cors-domain.jinja
mode = 0644
[monitor-check-webrunner-internal-instance]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
download-only = true
#md5sum = 4c44d617d5bfd1db8695200e896480c0
destination = ${buildout:parts-directory}/${:filename}
filename = monitor-check-webrunner-internal-instances.py
mode = 0644
[eggs]
recipe = z3c.recipe.scripts
eggs =
...
...
software/slaprunner/instance-runner-export.cfg.in
View file @
74d58ae3
...
...
@@ -50,6 +50,7 @@ parts +=
## Monitor for runner
monitor-current-log-access
monitor-check-resilient-feed-file
monitor-check-webrunner-internal-instance
[exporter]
...
...
software/slaprunner/instance-runner.cfg
View file @
74d58ae3
...
...
@@ -52,6 +52,7 @@ parts =
## Monitor for runner
monitor-current-log-access
monitor-deploy-cors-domain-cgi
monitor-check-webrunner-internal-instance
extends = ${monitor-template:output}
...
...
@@ -716,6 +717,13 @@ context =
key this_file :filename
key httpd_graceful cgi-httpd-graceful-wrapper:rendered
[monitor-check-webrunner-internal-instance]
recipe = slapos.recipe.template:jinja2
template = ${monitor-check-webrunner-internal-instance:location}/${monitor-check-webrunner-internal-instance:filename}
rendered = $${monitor-directory:monitor-custom-scripts}/$${:filename}
filename = monitor-check-webrunner-internal-instance.py
mode = 0744
[monitor-httpd-cors]
recipe = plone.recipe.command
command = if [ ! -f $${:location} ]; then touch $${:location}; fi
...
...
software/slaprunner/template/monitor-check-webrunner-internal-instances.py
0 → 100644
View file @
74d58ae3
#!/usr/bin/python
import
os
import
subprocess
import
sys
def
runPromise
(
promise_path
):
promise_relative_path
=
promise_path
.
replace
(
os
.
path
.
expanduser
(
'~'
),
'~'
)
print
'Running promise %s...'
%
promise_relative_path
promise_process
=
subprocess
.
Popen
(
promise_path
,
stderr
=
subprocess
.
PIPE
)
stdout
,
stderr
=
promise_process
.
communicate
()
return_code
=
promise_process
.
returncode
if
return_code
==
0
:
print
'Success.'
return
True
else
:
sys
.
stderr
.
write
(
'Failure while running promise %s. %s
\
n
'
%
(
promise_relative_path
,
stderr
))
def
getPromisePathListFromPartitionPath
(
partition_path
):
promise_directory_path
=
os
.
path
.
join
(
partition_path
,
'etc/promise'
)
try
:
promise_name_list
=
os
.
listdir
(
promise_directory_path
)
return
[
os
.
path
.
join
(
promise_directory_path
,
promise_name
)
for
promise_name
in
promise_name_list
]
except
OSError
:
return
[]
def
main
():
# XXX hardcoded
partition_root_path
=
os
.
path
.
expanduser
(
'~/srv/runner/instance'
)
success
=
True
for
partition_name
in
os
.
listdir
(
partition_root_path
):
partition_path
=
os
.
path
.
join
(
partition_root_path
,
partition_name
)
for
promise_path
in
getPromisePathListFromPartitionPath
(
partition_path
):
result
=
runPromise
(
promise_path
)
if
not
result
:
success
=
False
if
not
success
:
sys
.
exit
(
1
)
if
__name__
==
'__main__'
:
main
()
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