def bench_job(self, size_str, crud_index, i): """Creates a benchmark work job dict of a given size and crud "index" (where 0 is Create, 1 is Read, etc.). :size_str: One of the size strings defined in the scenario file :crud_index: An index into the CRUD array (0 is Create, etc.) :i: The job index :returns: A dictionary representing benchmark work job """ if crud_index == 0: return self.create_job(size_str, i) elif crud_index == 1: return self.job(size_str, type=ssbench.READ_OBJECT, block_size=self.block_size) elif crud_index == 2: return self.job(size_str, type=ssbench.UPDATE_OBJECT, block_size=self.block_size, size=random.randint( self.sizes_by_name[size_str]['size_min'], self.sizes_by_name[size_str]['size_max'])) elif crud_index == 3: return self.job(size_str, type=ssbench.DELETE_OBJECT)
def create_job(self, size_str, i, container=None, head_first=False): """ Creates job dict which will create an object. """ if container is None: container = random.choice(self.containers) return self.job(size_str, type=ssbench.CREATE_OBJECT, container=container, name='%s_%06d' % (size_str, i), size=random.randint( self.sizes_by_name[size_str]['size_min'], self.sizes_by_name[size_str]['size_max']), block_size=self.block_size, head_first=head_first, delete_after=self.delete_after)
def bench_job(self, size_str, crud_index, i): """Creates a benchmark work job dict of a given size and crud "index" (where 0 is Create, 1 is Read, etc.). :size_str: One of the size strings defined in the scenario file :crud_index: An index into the CRUD array (0 is Create, etc.) :i: The job index :returns: A dictionary representing benchmark work job """ if crud_index == 0: return self.create_job(size_str, i) elif crud_index == 1: return self.job(size_str, type=ssbench.READ_OBJECT, block_size=self.block_size) elif crud_index == 2: return self.job( size_str, type=ssbench.UPDATE_OBJECT, block_size=self.block_size, size=random.randint( self.sizes_by_name[size_str]['size_min'], self.sizes_by_name[size_str]['size_max'])) elif crud_index == 3: return self.job(size_str, type=ssbench.DELETE_OBJECT)