def testRunResolverSteps_NoneRaisesSignal(self): config = pipeline_pb2.ResolverConfig() text_format.Parse( """ resolver_steps { class_path: "tfx.orchestration.portable.input_resolution.processor_test.NoneStrategy" } """, config) with self.assertRaises(exceptions.InputResolutionError): processor.run_resolver_steps(self._input_dict, resolver_steps=config.resolver_steps, store=self._store)
def testRunResolverSteps_ResolverOp_IgnoresInputKeys(self): config = pipeline_pb2.ResolverConfig() text_format.Parse( r""" resolver_steps { class_path: "tfx.orchestration.portable.input_resolution.processor_test.RepeatOp" config_json: "{\"num\": 2}" input_keys: ["examples"] } """, config) result = processor.run_resolver_steps( self._input_dict, resolver_steps=config.resolver_steps, store=self._store) self.assertLen(result['examples'], 2) self.assertLen(result['model'], 2)
def testRunResolverSteps_ResolverStrategy(self): config = pipeline_pb2.ResolverConfig() text_format.Parse( r""" resolver_steps { class_path: "tfx.orchestration.portable.input_resolution.processor_test.RepeatStrategy" config_json: "{\"num\": 2}" } """, config) result = processor.run_resolver_steps( self._input_dict, resolver_steps=config.resolver_steps, store=self._store) strategy = RepeatStrategy.last_created self.assertIs(strategy.call_history[0][0], self._store) self.assertLen(result['examples'], 2) self.assertLen(result['model'], 2)
def testRunResolverSteps_ResolverOp(self): config = pipeline_pb2.ResolverConfig() text_format.Parse( r""" resolver_steps { class_path: "tfx.orchestration.portable.input_resolution.processor_test.RepeatOp" config_json: "{\"num\": 2}" } """, config) result = processor.run_resolver_steps( self._input_dict, resolver_steps=config.resolver_steps, store=self._store) op = RepeatOp.last_created self.assertIs(op.context.store, self._store) self.assertEqual(op.num, 2) self.assertLen(result['examples'], 2) self.assertLen(result['model'], 2)