You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by benqiu2016 <gi...@git.apache.org> on 2016/09/26 17:44:53 UTC

[GitHub] nifi-minifi-cpp pull request #13: MINIFI-109: Add ExecuteProcess

GitHub user benqiu2016 opened a pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/13

    MINIFI-109: Add ExecuteProcess

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/benqiu2016/nifi-minifi-cpp excecute_process_merge

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi-minifi-cpp/pull/13.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #13
    
----
commit 2e1b7599d6f59d014587c8db3890ac0843942a99
Author: Bin Qiu <be...@gmail.com>
Date:   2016-09-26T17:42:54Z

    MINIFI-109: Add ExecuteProcess

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp pull request #13: MINIFI-109: Add ExecuteProcess

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi-minifi-cpp/pull/13


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by apiri <gi...@git.apache.org>.
Github user apiri commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    Thanks!  Just makes it a little easier to cover as that one was closed out.  Much appreciated.  Was able to reproduce on a Linux environment.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp pull request #13: MINIFI-109: Add ExecuteProcess

Posted by apiri <gi...@git.apache.org>.
Github user apiri commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/13#discussion_r80707030
  
    --- Diff: inc/ExecuteProcess.h ---
    @@ -0,0 +1,112 @@
    +/**
    + * @file ExecuteProcess.h
    + * ExecuteProcess class declaration
    + *
    + * 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.
    + */
    +#ifndef __EXECUTE_PROCESS_H__
    +#define __EXECUTE_PROCESS_H__
    +
    +#include <stdio.h>
    +#include <unistd.h>
    +#include <string>
    +#include <errno.h>
    +#include <chrono>
    +#include <thread>
    +#include <unistd.h>
    +#include <sys/wait.h>
    +#include <iostream>
    +#include <sys/types.h>
    +#include <signal.h>
    +#include "FlowFileRecord.h"
    +#include "Processor.h"
    +#include "ProcessSession.h"
    +
    +//! ExecuteProcess Class
    +class ExecuteProcess : public Processor
    +{
    +public:
    +	//! Constructor
    +	/*!
    +	 * Create a new processor
    +	 */
    +	ExecuteProcess(std::string name, uuid_t uuid = NULL)
    +	: Processor(name, uuid)
    +	{
    +		_logger = Logger::getLogger();
    +		_redirectErrorStream = false;
    +		_batchDuration = 0;
    +		_workingDir = ".";
    +		_processRunning = false;
    +		_pid = 0;
    +	}
    +	//! Destructor
    +	virtual ~ExecuteProcess()
    +	{
    +		if (_processRunning && _pid > 0)
    +			kill(_pid, SIGTERM);
    +	}
    +	//! Processor Name
    +	static const std::string ProcessorName;
    +	//! Supported Properties
    +	static Property Command;
    +	static Property CommandArgument;
    --- End diff --
    
    Would be good to update this to CommandArguments for consistency.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by randerzander <gi...@git.apache.org>.
Github user randerzander commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    Will do. I assumed you would have considered it part of the original
    ExecuteProcess jira. Will reply here shortly
    
    On Sep 29, 2016 9:21 AM, "Aldrin Piri" <no...@github.com> wrote:
    
    hey @randerzander <https://github.com/randerzander> would you mind please
    opening a ticket in JIRA to report this so we can track appropriately?
    https://issues.apache.org/jira/browse/MINIFI
    
    \u2014
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    <https://github.com/apache/nifi-minifi-cpp/pull/13#issuecomment-250463867>,
    or mute the thread
    <https://github.com/notifications/unsubscribe-auth/ABnU8hCdn8N9rKTH7vW6XStO8nDyKdtSks5qu7tFgaJpZM4KGzNJ>
    .



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by randerzander <gi...@git.apache.org>.
Github user randerzander commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    @benqiu2016 @apiri saw that this got committed to master.
    
    Unfortunately, I'm getting build errors that strcpy and strtok are not members of 'std'. Including some build environment info and the errors produced.
    
    [root@d0a671fc9da1 nifi-minifi-cpp]# gcc --version
    gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    [root@d0a671fc9da1 nifi-minifi-cpp]# g++ --version
    g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    [root@d0a671fc9da1 nifi-minifi-cpp]# yum install -y boost-devel libxml2-devel
    Loaded plugins: fastestmirror, ovl
    Loading mirror speeds from cached hostfile
     * base: mirrors.umflint.edu
     * extras: mirror.trouble-free.net
     * updates: mirrors.centos.webair.com
    Package boost-devel-1.53.0-25.el7.x86_64 already installed and latest version
    Package libxml2-devel-2.9.1-6.el7_2.3.x86_64 already installed and latest version
    Nothing to do
    [root@d0a671fc9da1 nifi-minifi-cpp]# make
    mkdir -p ./build
    mkdir -p ./target
    make -C thirdparty/uuid
    make[1]: Entering directory `/nifi-minifi-cpp/thirdparty/uuid'
    gcc -g -Wall -rdynamic  -O0 -ggdb -g3 -fexceptions -Wno-write-strings -fvisibility=hidden -fPIC -I.. ./tst_uuid.c  libuuid.a -o ./tst_uuid
    make[1]: Leaving directory `/nifi-minifi-cpp/thirdparty/uuid'
    g++ -Os -fexceptions -fpermissive -Wno-write-strings -std=c++11 -fPIC -Wall -g -Wno-unused-private-field -I./inc -I./src -I./test -I./thirdparty -I/usr/include/libxml2 -I./thirdparty/yaml-cpp-yaml-cpp-0.5.3/include -o build/ExecuteProcess.o -c src/ExecuteProcess.cpp
    src/ExecuteProcess.cpp: In member function 'virtual void ExecuteProcess::onTrigger(ProcessContext*, ProcessSession*)':
    src/ExecuteProcess.cpp:101:2: error: 'strcpy' is not a member of 'std'
      std::strcpy(cstr, _fullCommand.c_str());
      ^
    src/ExecuteProcess.cpp:101:2: note: suggested alternative:
    In file included from ./inc/TimeUtil.h:25:0,
                     from src/ExecuteProcess.cpp:20:
    /usr/include/string.h:125:14: note:   'strcpy'
     extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
                  ^
    src/ExecuteProcess.cpp:102:12: error: 'strtok' is not a member of 'std'
      char *p = std::strtok (cstr, " ");
                ^
    src/ExecuteProcess.cpp:102:12: note: suggested alternative:
    In file included from ./inc/TimeUtil.h:25:0,
                     from src/ExecuteProcess.cpp:20:
    /usr/include/string.h:344:14: note:   'strtok'
     extern char *strtok (char *__restrict __s, const char *__restrict __delim)
                  ^
    src/ExecuteProcess.cpp:108:7: error: 'strtok' is not a member of 'std'
       p = std::strtok(NULL, " ");
           ^
    src/ExecuteProcess.cpp:108:7: note: suggested alternative:
    In file included from ./inc/TimeUtil.h:25:0,
                     from src/ExecuteProcess.cpp:20:
    /usr/include/string.h:344:14: note:   'strtok'
     extern char *strtok (char *__restrict __s, const char *__restrict __delim)
                  ^
    src/ExecuteProcess.cpp:198:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
           if (numRead == (sizeof(buffer) - totalRead))
                                                     ^


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by apiri <gi...@git.apache.org>.
Github user apiri commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    @benqiu2016 Looks good here!  Will merge in and thanks for the contribution.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by apiri <gi...@git.apache.org>.
Github user apiri commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    @randerzander Great, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by benqiu2016 <gi...@git.apache.org>.
Github user benqiu2016 commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    @apiri Address the above review comments. Thanks for the review.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by apiri <gi...@git.apache.org>.
Github user apiri commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    hey @randerzander would you mind please opening a ticket in JIRA to report this so we can track appropriately?  https://issues.apache.org/jira/browse/MINIFI


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by randerzander <gi...@git.apache.org>.
Github user randerzander commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    I have opened https://issues.apache.org/jira/browse/MINIFI-111


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi-minifi-cpp issue #13: MINIFI-109: Add ExecuteProcess

Posted by apiri <gi...@git.apache.org>.
Github user apiri commented on the issue:

    https://github.com/apache/nifi-minifi-cpp/pull/13
  
    Reviewing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---