From e694075c7fdcc9c4579d55b792da7a1391401b35 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 27 Mar 2018 16:40:59 +0200 Subject: testbeds, prototypes, model: Add docstrings This adds docstrings for methods of in the testbeds, prototypes and certain things in the model. --- rumba/testbeds/jfed.py | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'rumba/testbeds/jfed.py') diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index a1ceded..24e6737 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -47,11 +47,30 @@ logger = log.get_logger(__name__) class Testbed(mod.Testbed): - + """ + Represents a jFed testbed. + """ def __init__(self, exp_name, username, cert_file, exp_hours="2", proj_name="ARCFIRE", authority="wall2.ilabt.iminds.be", image=None, image_custom=False, image_owner=None, use_physical_machines=None): + """ + Initializes the testbed class. + + :param exp_name: The experiment name. + :param username: User of the experiment. + :param cert_file: Certificate file of the user. + :param exp_hours: Duration of the experiment. + :param proj_name: Project name of the experiment. + :param authority: Actual testbed authority to use. + :param image: Specific image to use. + :param image_custom: Is the image a custom one? + :param image_owner: Creator of the image. + :param use_physical_machines: Try to allocate physical machines. + + .. note:: Supported authorities are wall1.ilabt.iminds.be, + wall2.ilabt.iminds.be, exogeni.net, exogeni.net:umassvmsite. + """ passwd = getpass.getpass(prompt="Password for certificate file: ") mod.Testbed.__init__(self, exp_name, @@ -110,7 +129,13 @@ class Testbed(mod.Testbed): os.remove(tarball) self.flags['no_vlan_offload'] = True - def create_rspec(self, experiment): + def _create_rspec(self, experiment): + """ + Create an rspec which is an XML file with configuration for jFed. + + :param experiment: The experiment. + :return: rspec of the experiment. + """ impl = xml.getDOMImplementation() doc = impl.createDocument(None, "rspec", None) @@ -197,7 +222,12 @@ class Testbed(mod.Testbed): file.write(doc.toprettyxml()) file.close() - def swap_out(self, experiment): + def _swap_out(self, experiment): + """ + Swaps experiment out + + :param experiment: The experiment. + """ try: subprocess.check_call(["java", "-jar", self.jfed_jar, "delete", "-S", self.proj_name, "-s", self.exp_name, @@ -207,9 +237,16 @@ class Testbed(mod.Testbed): raise def _swap_in(self, experiment): + """ + Swaps experiment in + + :param experiment: The experiment. + """ + mod.Testbed.swap_in(self, experiment) + for node in experiment.nodes: node.ssh_config.set_http_proxy(self.http_proxy) - self.create_rspec(experiment) + self._create_rspec(experiment) auth_name_r = self.auth_name.replace(".", "-") -- cgit v1.2.3