| @@ 133-175 (lines=43) @@ | ||
| 130 | # all remaining iterations i.e. output becomes input and input becomes |
|
| 131 | # output. |
|
| 132 | ||
| 133 | def _run_plugin(self, exp, transport): |
|
| 134 | ''' |
|
| 135 | Execute the iterative processing. |
|
| 136 | ''' |
|
| 137 | # The docstring of this method in IterativePlugin is the following: |
|
| 138 | # |
|
| 139 | # Run the pre_process, process, and post_process methods. |
|
| 140 | # |
|
| 141 | # However, there is no obvious point where those methods are called, |
|
| 142 | # so perhaps this docstring isn't quite accurate? (Also note that this |
|
| 143 | # sentence has been copied from the docstring |
|
| 144 | # BaseDriver._run_plugin_instances(), so maybe it is just a generic |
|
| 145 | # description of what this method SHOULD do, but doesn't yet do, |
|
| 146 | # in IterativePlugin) |
|
| 147 | ||
| 148 | if self._ip_complete: |
|
| 149 | self.__finalise_datasets() |
|
| 150 | return |
|
| 151 | else: |
|
| 152 | print(f"Iteration {self._ip_iteration}...") |
|
| 153 | self.__set_datasets() |
|
| 154 | self._run_plugin_instances(transport, self.get_communicator()) |
|
| 155 | # transport.no_processing is related to the nTrans variable that |
|
| 156 | # is seen in various places in the "transport layer" |
|
| 157 | # TODO: figure out what nTrans is/means |
|
| 158 | if transport.no_processing: |
|
| 159 | self.set_processing_complete() |
|
| 160 | ||
| 161 | # if self._ip_fixed_iterations has been set to something other |
|
| 162 | # than its original value of False, and if the current iteration |
|
| 163 | # (the one that has just been completed) is the LAST iteration, |
|
| 164 | # then processing has been completed |
|
| 165 | # |
|
| 166 | # Note that _ip_iteration starts counting at 0, |
|
| 167 | # but _ip_fixed_iterations starts counting at 1, so if you have |
|
| 168 | # reached _ip_iteration=n, then this means that n+1 iterations |
|
| 169 | # have been performed |
|
| 170 | if self._ip_fixed_iterations and \ |
|
| 171 | self._ip_iteration == self._ip_fixed_iterations - 1: |
|
| 172 | self.set_processing_complete() |
|
| 173 | self._ip_iteration += 1 |
|
| 174 | # start another iteration |
|
| 175 | self._run_plugin(exp, transport) |
|
| 176 | ||
| 177 | def create_clone(self, clone, data): |
|
| 178 | clone.create_dataset(data) |
|
| @@ 69-84 (lines=16) @@ | ||
| 66 | self._ip_pattern_dict = {} |
|
| 67 | self._ip_pattern_dict['iterating'] = {} |
|
| 68 | ||
| 69 | def _run_plugin(self, exp, transport): |
|
| 70 | """ Runs the pre_process, process and post_process methods. |
|
| 71 | """ |
|
| 72 | self.__set_original_datasets() |
|
| 73 | ||
| 74 | while not self._ip_complete: |
|
| 75 | print ("Iteration", self._ip_iteration, "...") |
|
| 76 | self.__set_datasets() # change the pattern in this function? |
|
| 77 | self._run_plugin_instances(transport, self.get_communicator()) |
|
| 78 | if transport.no_processing: |
|
| 79 | self.set_processing_complete() |
|
| 80 | if self._ip_fixed_iterations and \ |
|
| 81 | self._ip_iteration == self._ip_fixed_iterations-1: |
|
| 82 | self.set_processing_complete() |
|
| 83 | self._ip_iteration += 1 |
|
| 84 | self.__finalise_datasets() |
|
| 85 | ||
| 86 | def __set_datasets(self): |
|
| 87 | ''' |
|