def match(patterns, limits=None):
     if len(patterns) == 1 and patterns[0] == _INPUT_PATTERN:
         return [
             mock.Mock(metadata_list=[
                 file_metadata_stub.FileMetadataStub(path, size)
                 for (path, size) in _INPUT_FILES_WITH_SIZE
             ])
         ]
     return []
예제 #2
0
 def test_disribute_files_on_workers_one(self):
   output_dir = 'test/out/dir'
   file_metadata_list = [file_metadata_stub.FileMetadataStub(path, size) for
                         (path, size) in _INPUT_FILES_WITH_SIZE]
   worker_actions_list = vep_runner_util.get_all_vm_io_info(
       file_metadata_list, output_dir, 1)
   self.assertEqual(1, len(worker_actions_list))
   single_worker_action_map = worker_actions_list[0].io_map
   self.assertDictEqual(
       single_worker_action_map,
       {f.path: '{}/{}{}'.format(output_dir, f.path,
                                 vep_runner_util._VEP_OUTPUT_SUFFIX)
        for f in file_metadata_list})
예제 #3
0
 def test_disribute_files_on_workers_multiple(self):
   output_dir = 'test/out/dir'
   file_metadata_list = [file_metadata_stub.FileMetadataStub(path, size) for
                         (path, size) in _INPUT_FILES_WITH_SIZE]
   worker_actions_list = vep_runner_util.get_all_vm_io_info(
       file_metadata_list, output_dir, 3)
   self.assertEqual(3, len(worker_actions_list))
   total_number_of_files = sum([len(l.io_map) for l in worker_actions_list])
   self.assertEqual(total_number_of_files,
                    len(_INPUT_FILES_WITH_SIZE))
   merged_dict = {}
   for actions_list in worker_actions_list:
     for k, v in actions_list.io_map.iteritems():
       merged_dict[k] = v
   self.assertDictEqual(
       merged_dict,
       {f.path: '{}/{}{}'.format(output_dir, f.path,
                                 vep_runner_util._VEP_OUTPUT_SUFFIX)
        for f in file_metadata_list})