def test_read_outputs(self): schema = SeedOutputsJson.construct_schema(self.seed_outputs_json) with patch("__builtin__.open", mock_open(read_data=json.dumps(self.outputs_json_dict))): result = SeedOutputsJson.read_outputs(schema) self.assertDictEqual(self.outputs_json_dict, result._dict)
def _capture_output_json(self, output_json_interface): """Captures any JSON property output from a job execution :param outputs_json_interface: List of output json interface objects :type outputs_json_interface: [:class:`job.seed.types.SeedOutputJson`] """ # Identify any outputs from seed.outputs.json try: schema = SeedOutputsJson.construct_schema(output_json_interface) outputs = SeedOutputsJson.read_outputs(schema) seed_outputs_json = outputs.get_values(output_json_interface) for key in seed_outputs_json: self.add_output_json(key, seed_outputs_json[key]) except IOError: logger.warning('No seed.outputs.json file found to process.')
def _capture_output_json(self, output_json_interface): """Captures any JSON property output and supplemental metadata to associate with inputs from a job execution This will provide replacement for the legacy parse_results functionality and allow source files to be augmented with additional metadata by jobs with domain specific knowledge. :param outputs_json_interface: List of output json interface objects :type outputs_json_interface: [:class:`job.seed.types.SeedOutputJson`] """ # Identify any outputs from seed.outputs.json try: schema = SeedOutputsJson.construct_schema(output_json_interface) outputs = SeedOutputsJson.read_outputs(schema) seed_outputs_json = outputs.get_values(output_json_interface) for key in seed_outputs_json: self.add_output_json(key, seed_outputs_json[key]) except IOError: logger.warning('No seed.outputs.json file found to process.')
def test_construct_schema(self): self.assertDictEqual( self.schema, SeedOutputsJson.construct_schema(self.seed_outputs_json))