Github user minifirocks commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/183#discussion_r150886943
  
    --- Diff: extensions/tensorflow/TFApplyGraph.cpp ---
    @@ -0,0 +1,227 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +#include "TFApplyGraph.h"
    +
    +#include "tensorflow/cc/ops/standard_ops.h"
    +
    +namespace org {
    +namespace apache {
    +namespace nifi {
    +namespace minifi {
    +namespace processors {
    +
    +core::Property TFApplyGraph::InputNode(  // NOLINT
    +    "Input Node",
    +    "The node of the TensorFlow graph to feed tensor inputs to", "");
    +core::Property TFApplyGraph::OutputNode(  // NOLINT
    +    "Output Node",
    +    "The node of the TensorFlow graph to read tensor outputs from", "");
    +
    +core::Relationship TFApplyGraph::Success(  // NOLINT
    +    "success",
    +    "Successful graph application outputs");
    +core::Relationship TFApplyGraph::Retry(  // NOLINT
    +    "retry",
    +    "Inputs which fail graph application but may work if sent again");
    +core::Relationship TFApplyGraph::Failure(  // NOLINT
    +    "failure",
    +    "Failures which will not work if retried");
    +
    +void TFApplyGraph::initialize() {
    +  std::set<core::Property> properties;
    +  properties.insert(InputNode);
    +  properties.insert(OutputNode);
    +  setSupportedProperties(std::move(properties));
    +
    +  std::set<core::Relationship> relationships;
    +  relationships.insert(Success);
    +  relationships.insert(Retry);
    +  relationships.insert(Failure);
    +  setSupportedRelationships(std::move(relationships));
    +}
    +
    +void TFApplyGraph::onSchedule(core::ProcessContext *context, 
core::ProcessSessionFactory *sessionFactory) {
    +  context->getProperty(InputNode.getName(), input_node_);
    +
    +  if (input_node_.empty()) {
    +    logger_->log_error("Invalid input node");
    +  }
    +
    +  context->getProperty(OutputNode.getName(), output_node_);
    +
    +  if (output_node_.empty()) {
    +    logger_->log_error("Invalid output node");
    +  }
    +}
    +
    +void TFApplyGraph::onTrigger(const std::shared_ptr<core::ProcessContext> 
&context,
    +                             const std::shared_ptr<core::ProcessSession> 
&session) {
    +  auto flow_file = session->get();
    --- End diff --
    
    we overwrite the flow input with output, do we have a use case that we need 
to keep input and create a new flow for output.


---

Reply via email to