From 3e5a3aa56ab3652d43d845dac4abde1e1a2644e9 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Tue, 27 Mar 2018 14:35:19 +0200 Subject: model/sb: fix small bugs + manage spaces in server and client ap when building id + fix typo in node.fetch_file --- rumba/model.py | 2 +- rumba/storyboard.py | 14 +++++++++++--- 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 ", 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 -- cgit v1.2.3