コード例 #1
0
 def test_get_cache_return_value_matches_outputs(self):
     cache = CallCache(cfg=self.cfg, logger=self.logger)
     rundir, outputs = self._run(self.test_wdl,
                                 self.ordered_input_dict,
                                 cfg=self.cfg)
     inputs = values_from_json(self.ordered_input_dict,
                               self.doc.tasks[0].available_inputs)
     input_digest = cache.get_digest_for_inputs(inputs)
     task_digest = cache.get_digest_for_task(task=self.doc.tasks[0])
     cache_value = cache.get(
         key=f"{self.doc.tasks[0].name}_{task_digest}/{input_digest}",
         output_types=self.doc.tasks[0].effective_outputs)
     self.assertEqual(values_to_json(outputs), values_to_json(cache_value))
コード例 #2
0
 def test_task_input_cache_matches_output(self):
     # run task, check output matches what was stored in run_dir
     cache = CallCache(cfg=self.cfg, logger=self.logger)
     rundir, outputs = self._run(self.test_wdl,
                                 self.ordered_input_dict,
                                 cfg=self.cfg)
     inputs = values_from_json(self.ordered_input_dict,
                               self.doc.tasks[0].available_inputs)
     input_digest = cache.get_digest_for_inputs(inputs)
     task_digest = cache.get_digest_for_task(task=self.doc.tasks[0])
     with open(
             os.path.join(
                 self.cache_dir,
                 f"{self.doc.tasks[0].name}_{task_digest}/{input_digest}.json"
             )) as f:
         read_data = json.loads(f.read())
     self.assertEqual(read_data, WDL.values_to_json(outputs))