Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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.')
Exemplo n.º 3
0
    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.')
Exemplo n.º 4
0
    def test_get_values(self):
        outputs_obj = SeedOutputsJson(self.outputs_json_dict, self.schema)

        results = outputs_obj.get_values(self.seed_outputs_json)

        self.assertDictEqual(results, {'INPUT_SIZE': 50})
Exemplo n.º 5
0
 def test_construct_schema(self):
     self.assertDictEqual(
         self.schema,
         SeedOutputsJson.construct_schema(self.seed_outputs_json))