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
9ef171f8
Commit
9ef171f8
authored
Nov 22, 2012
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some comments on wrappers
parent
719fb736
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
9 deletions
+24
-9
slapos/recipe/addresiliency/bully.py
slapos/recipe/addresiliency/bully.py
+2
-0
slapos/recipe/librecipe/generic.py
slapos/recipe/librecipe/generic.py
+8
-6
slapos/recipe/notifier.py
slapos/recipe/notifier.py
+10
-2
slapos/recipe/pbs.py
slapos/recipe/pbs.py
+4
-1
No files found.
slapos/recipe/addresiliency/bully.py
View file @
9ef171f8
...
...
@@ -134,6 +134,7 @@ class ResilientInstance(object):
if
self
.
participant_id
!=
new_id
:
self
.
halter_id
=
new_id
self
.
participant_id
=
new_id
log
.
debug
(
'I am {} of {}'
.
format
(
self
.
participant_id
,
self
.
total_participants
))
## Needs to be changed to use the master
def
aliveManagement
(
self
):
...
...
@@ -251,6 +252,7 @@ class Wrapper(object):
params
=
open
(
self
.
confpath
,
'r'
).
readlines
()
self
.
ips
=
params
[
0
].
split
()
self
.
participant_id
=
int
(
params
[
1
])
log
.
debug
(
'I am {} of {}'
.
format
(
self
.
participant_id
,
self
.
ips
))
def
start
(
self
):
self
.
getConnectionInfo
()
...
...
slapos/recipe/librecipe/generic.py
View file @
9ef171f8
...
...
@@ -127,16 +127,18 @@ class GenericBaseRecipe(object):
path
,
arguments
=
arguments
)[
0
]
return
script
def
createWrapper
(
self
,
name
,
command
,
parameters
):
def
createWrapper
(
self
,
name
,
command
,
parameters
,
comments
=
[]
):
"""
Creates a very simple (one command) shell script for process replacement.
Takes care of quoting.
"""
lines
=
[
'#!/bin/sh'
,
'exec %s'
%
shlex
.
quote
(
command
)
]
lines
=
[
'#!/bin/sh'
]
for
comment
in
comments
:
lines
.
append
(
'# %s'
%
comment
)
lines
.
append
(
'exec %s'
%
shlex
.
quote
(
command
))
for
param
in
parameters
:
if
len
(
lines
[
-
1
])
<
30
:
...
...
slapos/recipe/notifier.py
View file @
9ef171f8
...
...
@@ -39,7 +39,11 @@ class Recipe(GenericBaseRecipe):
'--feeds'
,
options
[
'feeds'
],
'--equeue-socket'
,
options
[
'equeue-socket'
],
options
[
'host'
],
options
[
'port'
]
])
],
comments
=
[
''
,
'Upon receiving a notification, execute the callback(s).'
,
''
])
return
[
script
]
...
...
@@ -77,7 +81,11 @@ class Notify(GenericBaseRecipe):
return
self
.
createWrapper
(
name
=
wrapper
,
command
=
notifier_binary
,
parameters
=
parameters
)
parameters
=
parameters
,
comments
=
[
''
,
'Call an executable and send notification(s).'
,
''
])
def
install
(
self
):
...
...
slapos/recipe/pbs.py
View file @
9ef171f8
...
...
@@ -150,8 +150,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
parameters
.
extend
([
'--restore-as-of'
,
'now'
])
parameters
.
append
(
'--force'
)
parameters
.
extend
([
local_directory
,
remote_directory
])
comments
=
[
''
,
'Push data to a PBS *-import instance.'
,
''
]
else
:
parameters
.
extend
([
remote_directory
,
local_directory
])
comments
=
[
''
,
'Pull data from a PBS *-export instance.'
,
''
]
wrapper_basepath
=
os
.
path
.
join
(
self
.
options
[
'wrappers-directory'
],
url_hash
)
...
...
@@ -163,7 +165,8 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
wrapper
=
self
.
createWrapper
(
name
=
wrapper_path
,
command
=
self
.
options
[
'rdiffbackup-binary'
],
parameters
=
parameters
)
parameters
=
parameters
,
comments
=
comments
)
path_list
.
append
(
wrapper
)
if
'notify'
in
entry
:
...
...
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