예제 #1
0
 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)
예제 #2
0
파일: cli.py 프로젝트: jumping/cloudkeeper
    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')
예제 #3
0
    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")