2 Parse a complete swarm set of compressed file.
4 Use information provied by the swarm description file. Storage is handled
5 through the help of the access configuration file.
7 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
17 # Define default values for swarm description and access config files.
18 default_swarm_description_file = "tests/config.sample.ini"
19 default_access_config_file = "tests/access.sample.ini"
23 python parse_swarm.py -s /path/to/swarm-description-file
24 -a /path/to/access-config-file
26 # Arguments are swarm description file and access config file.
27 parser = argparse.ArgumentParser()
28 parser.add_argument("-s", metavar="/path/to/swarm-description-file",
29 default=default_swarm_description_file)
30 parser.add_argument("-a", metavar="/path/to/access-config-file",
31 default=default_access_config_file)
33 args = parser.parse_args()
34 swarm_description_file = args.s
35 access_config_file = args.a
37 swarm_description = config.SwarmDescription()
38 swarm_description.load(swarm_description_file)
39 access_config = config.AccessConfig()
40 access_config.load(access_config_file)
41 swarm_writer = access_config.get_swarm_writer()
43 # Enhance swarm description with session id. Store enhanced file.
44 top.enhance_swarm_description(swarm_description, swarm_writer)
45 swarm_description_file_enhanced = swarm_description_file + ".enhanced"
46 swarm_description.store(swarm_description_file_enhanced)
49 top.parse_swarm(swarm_description, swarm_writer)
51 if __name__ == "__main__":