aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2018-03-27 14:35:19 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-03-27 15:24:51 +0200
commit3e5a3aa56ab3652d43d845dac4abde1e1a2644e9 (patch)
tree7a958769a9119ca8acb0ff0189a9ad5b467422d3
parent485ab3a152d36a5209fe01f6868472f07b25c99c (diff)
downloadrumba-3e5a3aa56ab3652d43d845dac4abde1e1a2644e9.tar.gz
rumba-3e5a3aa56ab3652d43d845dac4abde1e1a2644e9.zip
model/sb: fix small bugs
+ manage spaces in server and client ap when building id + fix typo in node.fetch_file
-rw-r--r--rumba/model.py2
-rw-r--r--rumba/storyboard.py14
2 files changed, 12 insertions, 4 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 0ec301a..d46cff9 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -363,7 +363,7 @@ class Node(object):
self.executor.fetch_files(self, paths, destination, sudo)
def fetch_file(self, path, destination, sudo=False):
- self.executor.fetch_files(self, path, destination, sudo)
+ self.executor.fetch_file(self, path, destination, sudo)
def set_link_state(self, dif, state):
ipcp = self.get_ipcp_by_dif(dif)
diff --git a/rumba/storyboard.py b/rumba/storyboard.py
index 1d6858e..978df85 100644
--- a/rumba/storyboard.py
+++ b/rumba/storyboard.py
@@ -83,7 +83,7 @@ class Client(SBEntity):
def __init__(self, ap, nodes=None, options=None,
shutdown="kill <pid>", c_id=None):
self.ap = ap
- e_id = c_id if c_id is not None else self.ap
+ e_id = c_id if c_id is not None else self.ap.replace(' ', '_')
super(Client, self).__init__(e_id)
self.startup = (ap + ((" " + options) if options is not None else ""))
if isinstance(nodes, model.Node):
@@ -100,7 +100,7 @@ class Client(SBEntity):
def process(self, duration, node=None, proc_id=None):
if proc_id is None:
- proc_id = "%s_%s" % (self.ap, self.get_id())
+ proc_id = "%s_%s" % (self.id, self.get_id())
if node is None:
if len(self.nodes) == 0:
raise ValueError('No nodes for client %s'
@@ -201,11 +201,19 @@ class ClientProcess(SBEntity):
# @nodes: Specific nodes to start this server on
#
class Server(SBEntity):
+
+ current_id = -1
+
+ @classmethod
+ def get_id(cls):
+ cls.current_id += 1
+ return cls.current_id
+
def __init__(self, ap, arrival_rate, mean_duration,
options=None, max_clients=float('inf'),
clients=None, nodes=None, min_duration=2, s_id=None):
self.ap = ap
- e_id = s_id if s_id is not None else self.ap
+ e_id = s_id if s_id is not None else self.ap.replace(' ', '_')
super(Server, self).__init__(e_id)
self.options = options if options is not None else ""
self.max_clients = max_clients