code: def run_cleanup(self, env, exit_code):
          
          output = []
          if self.pipeline.data.hooks and len(self.pipeline.data.hooks.cleanup) > 0:
              env.update({'PIPELINE_RESULT': 'FAILURE'})
              env.update({'PIPELINE_SHELL_EXIT_CODE': str(exit_code)})
              config = ShellConfig(script=self.pipeline.data.hooks.cleanup,
                                   model=self.pipeline.model, env=env,
                                   dry_run=self.pipeline.options.dry_run,
                                   debug=self.pipeline.options.debug,
                                   strict=self.pipeline.options.strict,
                                   temporary_scripts_path=self.pipeline.options.temporary_scripts_path)
              cleanup_shell = Bash(config)
              for line in cleanup_shell.process():
                  output.append(line)
                  self.logger.info(" | %s", line)
          return output
docs: Run cleanup hook when configured.