Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Introduction


Run plugin allows user to run any executable binary installed and available on all Hadoop nodes. The user code is capable of processing the input record and return the output record to be further processed downstream in the pipeline. 

Use-Case


Often times, in enterprise there are existing tools or systems that exist and perform complex transformations of data. These tools are time tested and have been running in production for long time. As more and more processing is being moved to Hadoop, users would like to slowly transition to running on Hadoop. In this case, they would like to have the ability to run the tools as in or with minor modifications. They have the tool or binary installed on all Hadoop nodes and they would like the ability to pass the processing record into the tool and retrieve the results back into the pipeline. 

User Stories

  • User should be able to specify the fully path to binary or just the binary
  • User should be able to specify the arguments for the binary to be executed
  • User should be provided a specification about how the record is passed to binary (need to be designed)
  • If binary executable doesn’t exist or not in path or not executable, user should be notified appropriately during runtime
  • User is able to see the errors in log if the executable writes the errors to STDERR
  • User executable is able to read the record from STDIN
  • User executable is able to write the record to STDOUT
  • User executable is able to write the error records to a different FILE descriptor 
  • User should be able to specify the error dataset to which data returned from executable special FILE descriptor
  • User will make sure the binary and it’s dependencies are available on all machines of the cluster and no capability needs to be added to the plugin for marshaling the executable

Conditions

  • Binary and it’s dependencies must be available on all the machines of the cluster, prior to the execution of binary.
  • Arguments should be in the proper sequence and the supported format. Any mismatch in the sequence of the arguments will result into the failure of execution.

Design

For both the design approaches, following are the assumptions/considerations:

For the below following cases:
a) Binary with zero number of arguments or no arguments.
b) Binary that takes a File or DB Name (Not STDIN or Hydrator Source Stage)
User is not restricted to execute the binary. However, the Hydrator source stage will not be utilized and the binary will run again and again, for each record coming through the source stage.


Design Approach Assumptions/Considerations:

  1. Types of binary executable that will be supported by plugin are:
 a) .bat
 b) .exe
 c) .sh
 d) .jar
And to select the executable type, dropdown will be provided to the user.Design Approach:User can pass the input to the binary, either through "Hydrator Soruce Stage" or "STDIN". And to select the options drop down will be provided.
Arguments for the binary will be passed in this format: For example,
  1. "bat, jar, sh and exe".

  2. Binaries can take 0 to N arguments. Source for the variable arguments will always be the structured records coming through the Hydrator Source stage.(As it is a transform plugin)

  3. Sequence of arguments is important. Any mismatch will result into the failure of the execution. Also, the fixed arguments will always be followed by the variable input arguments. This will be the format of the arguments for any binary to be executed. For example, 
    java -jar <Example.jar> <runtime/variable
field1>
  1. arg1> <runtime/variable
field2>Arguments should be in sequence. Any mismatch in the sequence of the arguments will result into the failure of execution.

Run Plugin Properties:

  • binaryType : Type of the binary to be executed. For example, .jar or .bat or .sh or .exe.
  • binaryName : Full path to the binary to be executed.
  • inputSource : Source to read the data for runtime/variable input arguments for binary to be executed. For example, Hydrator Source Stage or STDIN
variableArguments 
  1. arg2>..... <Other fixed/static named & unnamed arguments>
Note: All the static/fixed named or unnamed arguments will be passed after the actual input arguments coming through Hydrator Source or STDIN.

  1. Errors will be written to the cdap logs and the respective record will be stored in the Error Dataset, if the executable binary writes the errors to STDERR.

  2. The output of the binary execution will be stored into the target/output fields which will be provided by user. Final output will include the output fields as well as the input fields coming from the previous stage.

  3. In case, if the binaries do not produce any output, then plugin will write empty string to the target/output field.

 

Run Plugin Properties:

  • commandToExecute : Command that will contain the path to the binary as well as how to execute that binary. For example, java -jar /home/user.ExampleRunner.jar, if the binary to executed is of type jar.
  • variableArguments : A comma-separated sequence of the fields which will be used as input source for the runtime/variable arguments. For example, firstname or firstname,lastname in case of multiple arguments. Please make sure that the sequence of arguments is proper.
  • fixedArguments : A space-separated sequence of the fixed input arguments that will be passed to the binary to be executed. Please make sure that the sequence of the arguments is proper. All the fixed input arguments are followed by the runtime/variable input arguments.
  • outputFields : A comma-separated sequence of field name and its type which will be used to store the final output of the binary.
 


Run Input Json Format:

{
    
  "name": "Run",
    
  "type": "transform",
    
    "properties": {
         "binaryType
      "commandToExecute": "
jar",         "binaryName": "
java -jar /opt/cdap/Runner.jar",

         "inputSource": "HydratorSource",

         "
      "variableArguments": "
firstname
Firstname,
lastname
Lastname",
        
      "fixedArguments": "256 1024 -
Dcheckstule
Dcheckstyle.skip=true",
         
      "outputFields": "FinalOutput:string",
    
    }
 
}

Note: More details will be added based on the findings.

Implementation Tips


Table of Contents

Table of Contents
stylecircle

Checklist

  •  User stories documented 
  •  User stories reviewed 
  •  Design documented 
  •  Design reviewed 
  •  Feature merged 
  •  Examples and guides 
  •  Integration tests 
  •  Documentation for feature 
  •  Short video demonstrating the feature