def backup_graph(event: Event): graph = event.data backup = graph2pickle(graph) backup_file = f"{'graph'}_{datetime.utcnow().strftime('%Y%m%d%H%M%S%f')}.bak" backup_path = Path(ArgumentParser.args.backup_to) / backup_file log.info(f"Graph Backup to {backup_path}") with open(backup_path, "wb") as f: f.write(backup)
def cmd_backup(self, items: Iterable, args: str) -> Iterable: '''Usage: backup <filename> Create a backup of the graph. ''' filename = args with open(filename, 'wb') as outfile: yield (f'Writing Graph backup to {filename}') outfile.write(graph2pickle(self.graph)) yield ('done')
def cmd_backup(self, items: Iterable, args: str) -> Iterable: """Usage: backup <filename> Create a backup of the graph. """ filename = args with open(filename, "wb") as outfile: yield (f"Writing Graph backup to {filename}") outfile.write(graph2pickle(self.graph)) yield ("done")