You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by ti...@apache.org on 2013/07/18 07:07:05 UTC

svn commit: r1504364 - in /incubator/vxquery/trunk/vxquery: ./ vxquery-cli/src/main/java/org/apache/vxquery/cli/ vxquery-core/src/main/java/org/apache/vxquery/metadata/ vxquery-server/

Author: tillw
Date: Thu Jul 18 05:07:05 2013
New Revision: 1504364

URL: http://svn.apache.org/r1504364
Log:
create separate executables for cluster controller and node controllers

Added:
    incubator/vxquery/trunk/vxquery/vxquery-server/
    incubator/vxquery/trunk/vxquery/vxquery-server/pom.xml
Modified:
    incubator/vxquery/trunk/vxquery/pom.xml
    incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
    incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java

Modified: incubator/vxquery/trunk/vxquery/pom.xml
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/pom.xml?rev=1504364&r1=1504363&r2=1504364&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/pom.xml (original)
+++ incubator/vxquery/trunk/vxquery/pom.xml Thu Jul 18 05:07:05 2013
@@ -117,6 +117,7 @@
     <module>vxquery-parent</module>
     <module>vxquery-core</module>
     <module>vxquery-xtest</module>
+    <module>vxquery-server</module>
     <module>vxquery-cli</module>
   </modules>
  

Modified: incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java?rev=1504364&r1=1504363&r2=1504364&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java Thu Jul 18 05:07:05 2013
@@ -30,6 +30,7 @@ import org.apache.vxquery.context.Dynami
 import org.apache.vxquery.context.DynamicContextImpl;
 import org.apache.vxquery.context.RootStaticContextImpl;
 import org.apache.vxquery.context.StaticContextImpl;
+import org.apache.vxquery.exceptions.SystemException;
 import org.apache.vxquery.xmlquery.ast.ModuleNode;
 import org.apache.vxquery.xmlquery.query.Module;
 import org.apache.vxquery.xmlquery.query.XMLQueryCompiler;
@@ -85,86 +86,95 @@ public class VXQuery {
     }
 
     private void execute() throws Exception {
-        if (!opts.compileOnly) {
-            startLocalHyracks();
+        if (opts.clientNetIpAddress != null) {
+            hcc = new HyracksConnection(opts.clientNetIpAddress, opts.clientNetPort);
+            runQueries();
+        } else {
+            if (!opts.compileOnly) {
+                startLocalHyracks();
+            }
+            try {
+                runQueries();
+            } finally {
+                if (!opts.compileOnly) {
+                    stopLocalHyracks();
+                }
+            }
         }
-        try {
-            for (String query : opts.arguments) {
-                String qStr = slurp(query);
-                if (opts.showQuery) {
-                    System.err.println(qStr);
-                }
-                XQueryCompilationListener listener = new XQueryCompilationListener() {
-                    @Override
-                    public void notifyCodegenResult(Module module) {
-                        if (opts.showRP) {
-                            JobSpecification jobSpec = module.getHyracksJobSpecification();
-                            System.err.println(jobSpec.toString());
-                        }
+    }
+
+    private void runQueries() throws IOException, SystemException, Exception {
+        for (String query : opts.arguments) {
+            String qStr = slurp(query);
+            if (opts.showQuery) {
+                System.err.println(qStr);
+            }
+            XQueryCompilationListener listener = new XQueryCompilationListener() {
+                @Override
+                public void notifyCodegenResult(Module module) {
+                    if (opts.showRP) {
+                        JobSpecification jobSpec = module.getHyracksJobSpecification();
+                        System.err.println(jobSpec.toString());
                     }
+                }
 
-                    @Override
-                    public void notifyTranslationResult(Module module) {
-                        if (opts.showTET) {
-                            try {
-                                LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
-                                StringBuilder buffer = new StringBuilder();
-                                PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
-                                System.err.println(buffer.toString());
-                            } catch (AlgebricksException e) {
-                                e.printStackTrace();
-                            }
+                @Override
+                public void notifyTranslationResult(Module module) {
+                    if (opts.showTET) {
+                        try {
+                            LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
+                            StringBuilder buffer = new StringBuilder();
+                            PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
+                            System.err.println(buffer.toString());
+                        } catch (AlgebricksException e) {
+                            e.printStackTrace();
                         }
                     }
+                }
 
-                    @Override
-                    public void notifyTypecheckResult(Module module) {
-                    }
+                @Override
+                public void notifyTypecheckResult(Module module) {
+                }
 
-                    @Override
-                    public void notifyOptimizedResult(Module module) {
-                        if (opts.showOET) {
-                            try {
-                                LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
-                                StringBuilder buffer = new StringBuilder();
-                                PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
-                                System.err.println(buffer.toString());
-                            } catch (AlgebricksException e) {
-                                e.printStackTrace();
-                            }
+                @Override
+                public void notifyOptimizedResult(Module module) {
+                    if (opts.showOET) {
+                        try {
+                            LogicalOperatorPrettyPrintVisitor v = new LogicalOperatorPrettyPrintVisitor();
+                            StringBuilder buffer = new StringBuilder();
+                            PlanPrettyPrinter.printPlan(module.getBody(), buffer, v, 0);
+                            System.err.println(buffer.toString());
+                        } catch (AlgebricksException e) {
+                            e.printStackTrace();
                         }
                     }
+                }
 
-                    @Override
-                    public void notifyParseResult(ModuleNode moduleNode) {
-                        if (opts.showAST) {
-                            System.err.println(new XStream(new DomDriver()).toXML(moduleNode));
-                        }
+                @Override
+                public void notifyParseResult(ModuleNode moduleNode) {
+                    if (opts.showAST) {
+                        System.err.println(new XStream(new DomDriver()).toXML(moduleNode));
                     }
-                };
-                File result = createTempFile("test");
-                XMLQueryCompiler compiler = new XMLQueryCompiler(listener);
-                CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(
-                        RootStaticContextImpl.INSTANCE), new FileSplit[] { new FileSplit("nc1",
-                        result.getAbsolutePath()) });
-                compiler.compile(query, new StringReader(qStr), ccb, opts.optimizationLevel);
-                if (opts.compileOnly) {
-                    continue;
                 }
+            };
+            File result = createTempFile("test");
+            XMLQueryCompiler compiler = new XMLQueryCompiler(listener);
+            CompilerControlBlock ccb = new CompilerControlBlock(new StaticContextImpl(
+                    RootStaticContextImpl.INSTANCE), new FileSplit[] { new FileSplit("nc1",
+                            result.getAbsolutePath()) });
+            compiler.compile(query, new StringReader(qStr), ccb, opts.optimizationLevel);
+            if (opts.compileOnly) {
+                continue;
+            }
 
-                Module module = compiler.getModule();
-                JobSpecification js = module.getHyracksJobSpecification();
+            Module module = compiler.getModule();
+            JobSpecification js = module.getHyracksJobSpecification();
 
-                DynamicContext dCtx = new DynamicContextImpl(module.getModuleContext());
-                js.setGlobalJobDataFactory(new VXQueryGlobalDataFactory(dCtx.createFactory()));
+            DynamicContext dCtx = new DynamicContextImpl(module.getModuleContext());
+            js.setGlobalJobDataFactory(new VXQueryGlobalDataFactory(dCtx.createFactory()));
 
-                for (int i = 0; i < opts.repeatExec; ++i) {
-                    runInProcess(js, result);
-                }
-            }
-        } finally {
-            if (!opts.compileOnly) {
-                stopLocalHyracks();
+            for (int i = 0; i < opts.repeatExec; ++i) {
+                runInProcess(js, result);
             }
         }
     }
@@ -241,6 +251,12 @@ public class VXQuery {
     }
 
     private static class CmdLineOptions {
+        @Option(name = "-client-net-ip-address", usage = "IP Address of the ClusterController")
+        public String clientNetIpAddress = null;
+
+        @Option(name = "-client-net-port", usage = "Port of the ClusterController (default 1098)")
+        public int clientNetPort = 1098;
+
         @Option(name = "-O", usage = "Optimization Level. Default: Full Optimization")
         private int optimizationLevel = Integer.MAX_VALUE;
 

Modified: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java?rev=1504364&r1=1504363&r2=1504364&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryCollectionOperatorDescriptor.java Thu Jul 18 05:07:05 2013
@@ -55,7 +55,7 @@ public class VXQueryCollectionOperatorDe
 
     @Override
     public IOperatorNodePushable createPushRuntime(IHyracksTaskContext ctx,
-            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) {
+            IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) throws HyracksDataException {
         final FrameTupleAccessor fta = new FrameTupleAccessor(ctx.getFrameSize(),
                 recordDescProvider.getInputRecordDescriptor(getActivityId(), 0));
         final ArrayTupleBuilder tb = new ArrayTupleBuilder(recordDescProvider.getOutputRecordDescriptor(

Added: incubator/vxquery/trunk/vxquery/vxquery-server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-server/pom.xml?rev=1504364&view=auto
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-server/pom.xml (added)
+++ incubator/vxquery/trunk/vxquery/vxquery-server/pom.xml Thu Jul 18 05:07:05 2013
@@ -0,0 +1,124 @@
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.vxquery</groupId>
+  <artifactId>apache-vxquery-server</artifactId>
+  <packaging>jar</packaging>
+  <version>0.1-incubating-SNAPSHOT</version>
+  <name>VXQuery Server</name>
+  <description>Apache VXQuery Server</description>
+
+  <parent>
+    <groupId>org.apache.vxquery</groupId>
+    <artifactId>apache-vxquery-parent</artifactId>
+    <version>0.1-incubating-SNAPSHOT</version>
+    <relativePath>../vxquery-parent</relativePath>
+  </parent>
+
+  <distributionManagement>
+    <site>
+      <id>vxquery.website</id>
+      <name>VXQuery Website</name>
+      <url>file:../../site/vxquery-server/</url>
+    </site>
+  </distributionManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>appassembler-maven-plugin</artifactId>
+        <version>1.1.1</version>
+        <executions>
+          <execution>
+            <configuration>
+              <programs>
+                <program>
+                  <mainClass>edu.uci.ics.hyracks.control.cc.CCDriver</mainClass>
+                  <name>vxquerycc</name>
+                </program>
+                <program>
+                  <mainClass>edu.uci.ics.hyracks.control.nc.NCDriver</mainClass>
+                  <name>vxquerync</name>
+                </program>
+              </programs>
+              <repositoryLayout>flat</repositoryLayout>
+              <repositoryName>lib</repositoryName>
+            </configuration>
+            <phase>package</phase>
+            <goals>
+              <goal>assemble</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-site-plugin</artifactId>
+        <version>3.0</version>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.vxquery</groupId>
+      <artifactId>apache-vxquery-core</artifactId>
+      <version>0.1-incubating-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>edu.uci.ics.hyracks</groupId>
+      <artifactId>hyracks-control-cc</artifactId>
+      <version>${hyracks.version}</version>
+      <type>jar</type>
+      <scope>compile</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>edu.uci.ics.hyracks</groupId>
+      <artifactId>hyracks-control-nc</artifactId>
+      <version>${hyracks.version}</version>
+      <type>jar</type>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>2.4</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>index</report>
+              <report>dependencies</report>
+              <report>plugins</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+        <configuration>
+            <linkOnly>true</linkOnly>
+        </configuration>            
+      </plugin>
+    </plugins>
+  </reporting>
+</project>