keith-turner commented on issue #957: Fluo scripts copy jars into fluo software 
dir.
URL: https://github.com/apache/fluo/issues/957#issuecomment-339999039
 
 
   To really test this script, will need to run Fluo locally. Running Fluo 
requires Hadoop, Accumulo, and Zookeeper be running and setting these up takes 
a lot of time.  We wrote [Uno](https://github.com/astralway/uno) to automate 
setting these up for local development.  Uno can be used to test these script 
changes.   The instructions below show how to use Uno to test the script 
changes.  
   
   ```bash
   git clone https://github.com/astralway/uno.git
   cd uno/
   # Uncomment export FLUO_REPO and set it to your fluo source directory.  This 
   # will cause uno fetch to build a snapshot version of fluo.  This soruce dir 
should 
   # have your modifications to fluo script.
   vim conf/uno.conf
   # This will build Fluo and download Hadoop, Zookeeper, and Accumulo
   ./bin/uno fetch fluo
   # This will configure Fluo, Hadoop, Zookeeper, and Accumulo and start them
   ./bin/uno setup fluo
   # This will add Fluo, Hadoop, Zookeeper, and Accumulo to path in current 
shell
    eval "$(./bin/uno env)"
   cp install/fluo-1.2.0-SNAPSHOT/conf/fluo-app.properties ./my-app.properties
   # Uncomment fluo.observer.init.dir and set it to dir containing 
   # fluo-tour-0.0.1-SNAPSHOT.jar.  Instructions later in this comment about
   # how to get this jar.
   vim my-app.properties # TODO describe what to edit
   fluo init -a myapp -p ./my-app.properties
   # run oracle process in background needed to exec transactions
   fluo oracle -a myapp > oracle.log &
   # This will download app jar from HDFS to tmp dir and execute it
   fluo exec myapp ft.Increment id000
   # Edit fluo script if not working as expected.  Changes will need to be 
copied
   # back to fluo source dir once you get it working as expected.
   vim install/fluo-1.2.0-SNAPSHOT/bin/fluo
   fluo exec myapp ft.Increment id000
   fluo exec myapp ft.Increment id002
   fluo scan -a myapp
   # Should see oracle running as first background job
   jobs
   # Kill oracle if its first background job
   kill %1
   # Kill Hadoop, Zookeeper, and Accumulo
   ./bin/uno kill
   ```
   Make sure to take a look at the Uno requirements section.  Uno requires 
password less ssh and JAVA_HOME to be set.  Make sure that `ssh localhost env | 
grep JAVA_HOME` works and does not ask for a password.
   
   The instructions above require a simple Fluo app for the exec command to 
execute.   I created 
[fluo-tour.zip](https://github.com/apache/fluo/files/1422443/fluo-tour.zip) 
containing a simple app and attached it.  To build this yourself, take the 
following java code.
   
   ```java
   package ft;
   import javax.inject.Inject;
   
   public class Increment {
     
     @Inject
     private static FluoConfiguration fluoConfig;
     
     private static Column SUM_COL = new Column("stat","sum");
     
     public static void main(String[] args) {
       try(FluoClient client = FluoFactory.newClient(fluoConfig)) {
         try(Transaction tx = client.newTransaction()) {
           int currSum = Integer.parseInt(tx.gets(args[0], SUM_COL,"0"));
           int newSum = currSum+1;
           tx.set(args[0], SUM_COL, newSum+"");
           tx.commit();
           System.out.println("Set sum to "+newSum);
         }
       }
     }
   }
   ```
   
   And do the following to quickly build a jar.
   
   ```bash
   git clone -b fluo-tour https://gitbox.apache.org/repos/asf/fluo-website 
fluo-tour
   cd fluo-tour/
   # copy Increment.java to src/main/java/ft
   mvn package
   # jar will be in target dir
   ```
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to