

def _trigger_result_snapshot(self, result):
    ' Triggers a snapshot of the results for continuing\n\n        :param result: Currently computed result\n\n        '
    timestamp = result[1]['finish_timestamp']
    timestamp_str = repr(timestamp).replace('.', '_')
    filename = ('result_%s' % timestamp_str)
    extension = '.ncnt'
    dump_filename = os.path.join(self._resume_path, (filename + extension))
    dump_file = open(dump_filename, 'wb')
    dill.dump(result, dump_file, protocol=2)
    dump_file.flush()
    dump_file.close()
    extension = '.rcnt'
    rename_filename = os.path.join(self._resume_path, (filename + extension))
    shutil.move(dump_filename, rename_filename)

dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/environment.py Environment._trigger_result_snapshot/original