X-Git-Url: http://git.onelab.eu/?p=nepi.git;a=blobdiff_plain;f=src%2Fnepi%2Fexecution%2Fresource.py;h=adcb438c4d9ddc9c2499e2457b7f429a9b1256f4;hp=16b434fbddb8c730010f329a842ea011756c9b38;hb=ea0cec9040a8c8cb4d9bce35bd05d39472e7c132;hpb=d60ce2041ab0d3053490c5c3d36c64cb164b1d1e diff --git a/src/nepi/execution/resource.py b/src/nepi/execution/resource.py index 16b434fb..adcb438c 100644 --- a/src/nepi/execution/resource.py +++ b/src/nepi/execution/resource.py @@ -83,7 +83,7 @@ def clsinit(cls): def clsinit_copy(cls): """ Initializes template information (i.e. attributes and traces) - on classes direved from the ResourceManager class. + on classes derived from the ResourceManager class. It differs from the clsinit method in that it forces inheritance of attributes and traces from the parent class. @@ -213,7 +213,7 @@ class ResourceManager(Logger): """ Resource subclasses will invoke this method to register resource traces - This method should be overriden in the RMs that define traces. + This method should be overridden in the RMs that define traces. """ @@ -401,7 +401,7 @@ class ResourceManager(Logger): @property def reserved_time(self): - """ Returns the resreved time of the RM as a timestamp """ + """ Returns the reserved time of the RM as a timestamp """ return self._reserved_time @property @@ -421,7 +421,7 @@ class ResourceManager(Logger): @property def failed_time(self): - """ Returns the time failure occured for the RM as a timestamp """ + """ Returns the time failure occurred for the RM as a timestamp """ return self._failed_time @property @@ -447,7 +447,7 @@ class ResourceManager(Logger): def register_connection(self, guid): """ Registers a connection to the RM identified by guid - This method should not be overriden. Specific functionality + This method should not be overridden. Specific functionality should be added in the do_connect method. :param guid: Global unique identified of the RM to connect to @@ -461,7 +461,7 @@ class ResourceManager(Logger): def unregister_connection(self, guid): """ Removes a registered connection to the RM identified by guid - This method should not be overriden. Specific functionality + This method should not be overridden. Specific functionality should be added in the do_disconnect method. :param guid: Global unique identified of the RM to connect to @@ -479,7 +479,7 @@ class ResourceManager(Logger): This method is responsible for selecting an individual resource matching user requirements. - This method should not be overriden directly. Specific functionality + This method should not be overridden directly. Specific functionality should be added in the do_discover method. """ @@ -494,7 +494,7 @@ class ResourceManager(Logger): This method is responsible for reserving an individual resource matching user requirements. - This method should not be overriden directly. Specific functionality + This method should not be overridden directly. Specific functionality should be added in the do_reserved method. """ @@ -510,7 +510,7 @@ class ResourceManager(Logger): After this method has been successfully invoked, the resource should be accessible/controllable by the RM. - This method should not be overriden directly. Specific functionality + This method should not be overridden directly. Specific functionality should be added in the do_provision method. """ @@ -518,6 +518,22 @@ class ResourceManager(Logger): if self._state != ResourceState.RELEASED: self.do_provision() + @failtrap + def configure(self): + """ Performs resource configuration. + + This method is responsible for configuring one resource. + After this method has been successfully invoked, the resource + should be set up to start the experimentation. + + This method should not be overridden directly. Specific functionality + should be added in the do_configure method. + + """ + with self._release_lock: + if self._state != ResourceState.RELEASED: + self.do_configure() + @failtrap def start(self): """ Starts the RM (e.g. launch remote process). @@ -525,7 +541,7 @@ class ResourceManager(Logger): There is no standard start behavior. Some RMs will not need to perform any actions upon start. - This method should not be overriden directly. Specific functionality + This method should not be overridden directly. Specific functionality should be added in the do_start method. """ @@ -545,7 +561,7 @@ class ResourceManager(Logger): There is no standard stop behavior. Some RMs will not need to perform any actions upon stop. - This method should not be overriden directly. Specific functionality + This method should not be overridden directly. Specific functionality should be added in the do_stop method. """ @@ -563,7 +579,7 @@ class ResourceManager(Logger): This method is responsible for deploying the resource (and invoking the discover and provision methods). - This method should not be overriden directly. Specific functionality + This method should not be overridden directly. Specific functionality should be added in the do_deploy method. """ @@ -581,7 +597,7 @@ class ResourceManager(Logger): This method is responsible for releasing resources that were used during the experiment by the RM. - This method should not be overriden directly. Specific functionality + This method should not be overridden directly. Specific functionality should be added in the do_release method. """ @@ -601,7 +617,7 @@ class ResourceManager(Logger): def fail(self): """ Sets the RM to state FAILED. - This method should not be overriden directly. Specific functionality + This method should not be overridden directly. Specific functionality should be added in the do_fail method. """ @@ -1053,6 +1069,9 @@ class ResourceManager(Logger): def do_provision(self): self.set_provisioned() + def do_configure(self): + pass + def do_start(self): self.set_started()