diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-06-06 16:13:35 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-06-06 16:13:35 +0200 |
commit | ffb6be1dae7bebf4596336acdefccbfe885bc8a9 (patch) | |
tree | be46105057e1fee9107db117766c98a540971070 | |
parent | 28d34549ecf3a6fe5dde672569b7e8f5e05f1a5e (diff) | |
download | rumba-ffb6be1dae7bebf4596336acdefccbfe885bc8a9.tar.gz rumba-ffb6be1dae7bebf4596336acdefccbfe885bc8a9.zip |
prototypes: Switch register and bind operation
This switches the register and bind operations in the ouroboros
prototype, to avoid a race condition when starting a server very fast.
-rwxr-xr-x | examples/docker-ouroboros.py | 3 | ||||
-rw-r--r-- | rumba/prototypes/ouroboros.py | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/examples/docker-ouroboros.py b/examples/docker-ouroboros.py index 1c6009c..ce30fdb 100755 --- a/examples/docker-ouroboros.py +++ b/examples/docker-ouroboros.py @@ -53,8 +53,7 @@ for i in range(0, args.nodes): nodes[0].add_dif(shim_prev) nodes[0].add_dif_registration(n01, shim_prev) -tb = docker.Testbed(exp_name = "ouroboros", - base_image = "ouroborosrumba/prototype") +tb = docker.Testbed(exp_name = "ouroboros") exp = our.Experiment(tb, nodes = nodes) diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 0c16482..1c24a0c 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -62,9 +62,6 @@ class OurServer(sb.Server): # Run and store PID n_cmd = 'pid=$(%s); ' % (o_cmd,) - # Add bind command - n_cmd += 'irm b process $pid name %s > /dev/null 2>&1; ' % (self.id,) - # Build register command r_cmd = 'irm r n %s ' % (self.id,) if len(self.difs) == 0: @@ -75,6 +72,10 @@ class OurServer(sb.Server): # Add register command n_cmd += r_cmd + + # Add bind command + n_cmd += 'irm b process $pid name %s > /dev/null 2>&1; ' % (self.id,) + n_cmd += 'echo $pid' # We need to return the pid for the sb return n_cmd @@ -148,7 +149,8 @@ class Experiment(mod.Experiment): time.sleep(2) else: for node in self.nodes: - node.execute_command("sudo nohup irmd > /dev/null &", time_out=None) + node.execute_command("sudo nohup irmd > /dev/null &", + time_out=None) def install_ouroboros(self): if isinstance(self.testbed, local.Testbed): |