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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jean-Paul Smets
slapos
Commits
69b1df32
Commit
69b1df32
authored
Nov 22, 2012
by
Marco Mariani
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/resiliency_annotated' into lapp-resilient2
parents
944d97c2
9ef171f8
Changes
4
Hide 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 @
69b1df32
...
@@ -134,6 +134,7 @@ class ResilientInstance(object):
...
@@ -134,6 +134,7 @@ class ResilientInstance(object):
if
self
.
participant_id
!=
new_id
:
if
self
.
participant_id
!=
new_id
:
self
.
halter_id
=
new_id
self
.
halter_id
=
new_id
self
.
participant_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
## Needs to be changed to use the master
def
aliveManagement
(
self
):
def
aliveManagement
(
self
):
...
@@ -251,6 +252,7 @@ class Wrapper(object):
...
@@ -251,6 +252,7 @@ class Wrapper(object):
params
=
open
(
self
.
confpath
,
'r'
).
readlines
()
params
=
open
(
self
.
confpath
,
'r'
).
readlines
()
self
.
ips
=
params
[
0
].
split
()
self
.
ips
=
params
[
0
].
split
()
self
.
participant_id
=
int
(
params
[
1
])
self
.
participant_id
=
int
(
params
[
1
])
log
.
debug
(
'I am {} of {}'
.
format
(
self
.
participant_id
,
self
.
ips
))
def
start
(
self
):
def
start
(
self
):
self
.
getConnectionInfo
()
self
.
getConnectionInfo
()
...
...
slapos/recipe/librecipe/generic.py
View file @
69b1df32
...
@@ -95,7 +95,7 @@ class GenericBaseRecipe(object):
...
@@ -95,7 +95,7 @@ class GenericBaseRecipe(object):
def
addLineToFile
(
self
,
filepath
,
line
,
encoding
=
'utf8'
):
def
addLineToFile
(
self
,
filepath
,
line
,
encoding
=
'utf8'
):
"""Append a single line to a text file, if the line does not exist yet.
"""Append a single line to a text file, if the line does not exist yet.
line must be unicode."""
line must be unicode."""
try
:
try
:
...
@@ -127,16 +127,18 @@ class GenericBaseRecipe(object):
...
@@ -127,16 +127,18 @@ class GenericBaseRecipe(object):
path
,
arguments
=
arguments
)[
0
]
path
,
arguments
=
arguments
)[
0
]
return
script
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.
Creates a very simple (one command) shell script for process replacement.
Takes care of quoting.
Takes care of quoting.
"""
"""
lines
=
[
lines
=
[
'#!/bin/sh'
]
'#!/bin/sh'
,
'exec %s'
%
shlex
.
quote
(
command
)
for
comment
in
comments
:
]
lines
.
append
(
'# %s'
%
comment
)
lines
.
append
(
'exec %s'
%
shlex
.
quote
(
command
))
for
param
in
parameters
:
for
param
in
parameters
:
if
len
(
lines
[
-
1
])
<
30
:
if
len
(
lines
[
-
1
])
<
30
:
...
...
slapos/recipe/notifier.py
View file @
69b1df32
...
@@ -39,7 +39,11 @@ class Recipe(GenericBaseRecipe):
...
@@ -39,7 +39,11 @@ class Recipe(GenericBaseRecipe):
'--feeds'
,
options
[
'feeds'
],
'--feeds'
,
options
[
'feeds'
],
'--equeue-socket'
,
options
[
'equeue-socket'
],
'--equeue-socket'
,
options
[
'equeue-socket'
],
options
[
'host'
],
options
[
'port'
]
options
[
'host'
],
options
[
'port'
]
])
],
comments
=
[
''
,
'Upon receiving a notification, execute the callback(s).'
,
''
])
return
[
script
]
return
[
script
]
...
@@ -77,7 +81,11 @@ class Notify(GenericBaseRecipe):
...
@@ -77,7 +81,11 @@ class Notify(GenericBaseRecipe):
return
self
.
createWrapper
(
name
=
wrapper
,
return
self
.
createWrapper
(
name
=
wrapper
,
command
=
notifier_binary
,
command
=
notifier_binary
,
parameters
=
parameters
)
parameters
=
parameters
,
comments
=
[
''
,
'Call an executable and send notification(s).'
,
''
])
def
install
(
self
):
def
install
(
self
):
...
...
slapos/recipe/pbs.py
View file @
69b1df32
...
@@ -150,8 +150,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
...
@@ -150,8 +150,10 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
parameters
.
extend
([
'--restore-as-of'
,
'now'
])
parameters
.
extend
([
'--restore-as-of'
,
'now'
])
parameters
.
append
(
'--force'
)
parameters
.
append
(
'--force'
)
parameters
.
extend
([
local_directory
,
remote_directory
])
parameters
.
extend
([
local_directory
,
remote_directory
])
comments
=
[
''
,
'Push data to a PBS *-import instance.'
,
''
]
else
:
else
:
parameters
.
extend
([
remote_directory
,
local_directory
])
parameters
.
extend
([
remote_directory
,
local_directory
])
comments
=
[
''
,
'Pull data from a PBS *-export instance.'
,
''
]
wrapper_basepath
=
os
.
path
.
join
(
self
.
options
[
'wrappers-directory'
],
wrapper_basepath
=
os
.
path
.
join
(
self
.
options
[
'wrappers-directory'
],
url_hash
)
url_hash
)
...
@@ -163,7 +165,8 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
...
@@ -163,7 +165,8 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
wrapper
=
self
.
createWrapper
(
name
=
wrapper_path
,
wrapper
=
self
.
createWrapper
(
name
=
wrapper_path
,
command
=
self
.
options
[
'rdiffbackup-binary'
],
command
=
self
.
options
[
'rdiffbackup-binary'
],
parameters
=
parameters
)
parameters
=
parameters
,
comments
=
comments
)
path_list
.
append
(
wrapper
)
path_list
.
append
(
wrapper
)
if
'notify'
in
entry
:
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