Exemple #1
0
    def testRemoveStatefulWorkingDirSucceeded(self):
        stateful_working_dir = (
            self._output_resolver().get_stateful_working_directory())
        self.assertTrue(fileio.exists(stateful_working_dir))

        outputs_utils.remove_stateful_working_dir(stateful_working_dir)
        self.assertFalse(fileio.exists(stateful_working_dir))
Exemple #2
0
def _remove_task_dirs(task: task_lib.ExecNodeTask) -> None:
    """Removes directories created for the task."""
    if task.stateful_working_dir:
        outputs_utils.remove_stateful_working_dir(task.stateful_working_dir)
    if task.tmp_dir:
        try:
            fileio.rmtree(task.tmp_dir)
        except fileio.NotFoundError:
            logging.warning(
                'tmp_dir %s not found while attempting to delete, ignoring.')
    if task.executor_output_uri:
        try:
            fileio.remove(task.executor_output_uri)
        except fileio.NotFoundError:
            logging.warning(
                'Skipping deletion of executor_output_uri (file not found): %s',
                task.executor_output_uri)
Exemple #3
0
 def _clean_up_stateful_execution_info(
         self, execution_info: data_types.ExecutionInfo):
     """Post execution clean up."""
     logging.info('Cleaning up stateful execution info.')
     outputs_utils.remove_stateful_working_dir(
         execution_info.stateful_working_dir)
Exemple #4
0
 def testRemoveStatefulWorkingDirOtherError(self, rmtree_fn):
     rmtree_fn.side_effect = ValueError('oops')
     with self.assertRaisesRegex(ValueError, 'oops'):
         outputs_utils.remove_stateful_working_dir('/a/fake/path')
Exemple #5
0
 def testRemoveStatefulWorkingDirNotFoundError(self):
     # removing a nonexisting path is an noop
     outputs_utils.remove_stateful_working_dir('/a/not/exist/path')