Build a Task that will measure the time span of checkpoint operations, once operation is done, time can be read from _current_checkpoint_duration. Args: cp_op_name: A string name of the checkpoint operation. add_op: A functor to add the checkpoint op
(self, cp_op_name, add_op)
| 232 | return self._names_output.fetch().tolist() |
| 233 | |
| 234 | def _timed_task(self, cp_op_name, add_op): |
| 235 | """ |
| 236 | Build a Task that will measure the time span of checkpoint operations, |
| 237 | once operation is done, time can be read from _current_checkpoint_duration. |
| 238 | |
| 239 | Args: |
| 240 | cp_op_name: A string name of the checkpoint operation. |
| 241 | add_op: A functor to add the checkpoint operation. |
| 242 | |
| 243 | Returns: |
| 244 | A task with timer. |
| 245 | """ |
| 246 | with Task(name=cp_op_name) as task: |
| 247 | with ops.task_init(): |
| 248 | timer = ops.TimerBegin([], counter_name=self._node_name) |
| 249 | add_op() |
| 250 | with ops.task_exit(): |
| 251 | time_span_blob = ops.TimerGetAndEnd(timer) |
| 252 | self._current_checkpoint_duration = final_output(time_span_blob) |
| 253 | return task |
| 254 | |
| 255 | def collect_checkpoint_stats(self, stats): |
| 256 | """ |
no test coverage detected