Ejemplo n.º 1
0
 def b_op(
     field_x: {
         'customized_type': {
             'openapi_schema_validator':
             '{"type": "string", "pattern": "^gcs://.*$"}'
         }
     }, field_y: Integer(), field_z: GCSPath()
 ) -> {
         'output_model_uri': 'GcsUri'
 }:
     return ContainerOp(name='operator b',
                        image='gcr.io/ml-pipeline/component-a',
                        command=[
                            'python3',
                            field_x,
                        ],
                        arguments=[
                            '--field-y',
                            field_y,
                            '--field-z',
                            field_z,
                        ],
                        file_outputs={
                            'output_model_uri': '/schema.txt',
                        })
Ejemplo n.º 2
0
 def b_op(
     field_x: {
         'customized_type': {
             'property_a': 'value_a',
             'property_b': 'value_b'
         }
     }, field_y: Integer(), field_z: GCSPath()
 ) -> {
         'output_model_uri': 'GcsUri'
 }:
     return ContainerOp(name='operator b',
                        image='gcr.io/ml-pipeline/component-a',
                        command=[
                            'python3',
                            field_x,
                        ],
                        arguments=[
                            '--field-y',
                            field_y,
                            '--field-z',
                            field_z,
                        ],
                        file_outputs={
                            'output_model_uri': '/schema.txt',
                        })
Ejemplo n.º 3
0
 def test_class_to_dict(self):
     """Test _class_to_dict function."""
     gcspath_dict = GCSPath().to_dict()
     golden_dict = {
         'GCSPath': {
             'openapi_schema_validator': {
                 "type": "string",
                 "pattern": "^gs://.*$"
             }
         }
     }
     self.assertEqual(golden_dict, gcspath_dict)
Ejemplo n.º 4
0
 def a_op(field_l: Integer()) -> {'field_m': GCSPath(), 'field_n': {'customized_type': {'property_a': 'value_a', 'property_b': 'value_b'}}, 'field_o': 'GcsUri'}:
   return ContainerOp(
     name = 'operator a',
     image = 'gcr.io/ml-pipeline/component-a',
     arguments = [
       '--field-l', field_l,
     ],
     file_outputs = {
       'field_m': '/schema.txt',
       'field_n': '/feature.txt',
       'field_o': '/output.txt'
     }
   )
Ejemplo n.º 5
0
 def test_class_to_dict(self):
     """Test _class_to_dict function."""
     gcspath_dict = _instance_to_dict(GCSPath())
     golden_dict = {'GCSPath': {}}
     self.assertEqual(golden_dict, gcspath_dict)