Commit 69b1df32 authored by Marco Mariani's avatar Marco Mariani

Merge remote-tracking branch 'origin/resiliency_annotated' into lapp-resilient2

parents 944d97c2 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()
......
......@@ -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:
......
......@@ -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):
......
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment