This module defines the BorgQueen class, which manages drones to assimilate data using Python’s multiprocessing.
- class BorgQueen(drone, rootpath=None, number_of_drones=1)
The Borg Queen controls the drones to assimilate data in an entire directory tree. Uses multiprocessing to speed up things considerably. It also contains convenience methods to save and load data between sessions.
drone (Drone) – An implementation of
pymatgen.apps.borg.hive.AbstractDroneto use for assimilation.
rootpath (str) – The root directory to start assimilation. Leave it as None if you want to do assimilation later, or is using the BorgQueen to load previously assimilated data.
ndrones (int) – Number of drones to parallelize over. Typical machines today have up to four processors. Note that you won’t see a 100% improvement with two drones over one, but you will definitely see a significant speedup of at least 50% or so. If you are running this over a server with far more processors, the speedup will be even greater.
Returns an list of assimilated objects
Load assimilated data from a file
Assimilate the entire subdirectory structure in rootpath.
Save the assimilated data to a file.
filename (str) – filename to save the assimilated data to. Note that if the filename ends with gz or bz2, the relevant gzip or bz2 compression will be applied.
Assimilate the entire subdirectory structure in rootpath serially.
Internal helper method for BorgQueen to process assimilation