@catch_nb_assignment<EOL><INDENT>def cell_complete(self, cell, cell_index=None, **kwargs):<DEDENT>
end_time = self.now()<EOL>if self.log_output:<EOL><INDENT>ceel_num = cell_index + <NUM_LIT:1> if cell_index is not None else '<STR_LIT>'<EOL>logger.info('<STR_LIT>'.format(ceel_num))<EOL>sys.stdout.flush()<EOL>sys.stderr.flush()<EOL><DEDENT>cell.metadata.papermill['<STR_LIT>'] = end_time.isoformat()<EOL>if cell.metadata.papermill.get('<STR_LIT>'):<EOL><INDENT>start_time = dateutil.parser.parse(cell.metadata.papermill['<STR_LIT>'])<EOL>cell.metadata.papermill['<STR_LIT>'] = (end_time - start_time).total_seconds()<EOL><DEDENT>if cell.metadata.papermill['<STR_LIT:status>'] != self.FAILED:<EOL><INDENT>cell.metadata.papermill['<STR_LIT:status>'] = self.COMPLETED<EOL><DEDENT>self.save()<EOL>if self.pbar:<EOL><INDENT>self.pbar.update(<NUM_LIT:1>)<EOL><DEDENT>
Finalize metadata for a cell and save notebook.

Optionally called by engines during execution to finalize the
metadata for a cell and save the notebook to the output path.