You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2014/04/09 00:16:31 UTC
[33/50] [abbrv] git commit: Added command line option for available
processors.
Added command line option for available processors.
Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/17e4f71a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/17e4f71a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/17e4f71a
Branch: refs/heads/master
Commit: 17e4f71a6b873249f50a4eca891310ea675e7d9f
Parents: 0febd9c
Author: Preston Carman <pr...@apache.org>
Authored: Thu Apr 3 15:38:51 2014 -0700
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Apr 3 15:38:51 2014 -0700
----------------------------------------------------------------------
.../main/java/org/apache/vxquery/cli/VXQuery.java | 5 ++++-
.../vxquery/metadata/VXQueryMetadataProvider.java | 4 +---
.../vxquery/xmlquery/query/XMLQueryCompiler.java | 18 ++++++++++++------
3 files changed, 17 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/17e4f71a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
----------------------------------------------------------------------
diff --git a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
index 13853f7..f882899 100644
--- a/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
+++ b/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
@@ -390,7 +390,7 @@ public class VXQuery {
}
/**
- * Shuts down the virtual cluster, alongwith all nodes and node execution, network and queue managers.
+ * Shuts down the virtual cluster, along with all nodes and node execution, network and queue managers.
*
* @throws Exception
*/
@@ -417,6 +417,9 @@ public class VXQuery {
* Helper class with fields and methods to handle all command line options
*/
private static class CmdLineOptions {
+ @Option(name = "-available-processors", usage = "Number of available processors. (default java's available processors)")
+ public int availableProcessors = -1;
+
@Option(name = "-client-net-ip-address", usage = "IP Address of the ClusterController")
public String clientNetIpAddress = null;
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/17e4f71a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
index 678b74a..40a02ae 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/metadata/VXQueryMetadataProvider.java
@@ -22,8 +22,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import javax.xml.namespace.QName;
-
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -98,7 +96,7 @@ public class VXQueryMetadataProvider implements IMetadataProvider<String, String
return getClusterLocations(nodeList, availableProcessors);
}
- private static AlgebricksPartitionConstraint getClusterLocations(String[] nodeList, int partitions) {
+ public static AlgebricksPartitionConstraint getClusterLocations(String[] nodeList, int partitions) {
ArrayList<String> locs = new ArrayList<String>();
for (String node : nodeList) {
for (int j = 0; j < partitions; j++) {
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/17e4f71a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
index 0c8ff90..91c7764 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryCompiler.java
@@ -39,10 +39,7 @@ import org.apache.vxquery.types.Quantifier;
import org.apache.vxquery.types.SequenceType;
import org.apache.vxquery.xmlquery.ast.ModuleNode;
import org.apache.vxquery.xmlquery.translator.XMLQueryTranslator;
-import org.omg.SendingContext.RunTime;
-import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
-import edu.uci.ics.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
import edu.uci.ics.hyracks.algebricks.compiler.api.HeuristicCompilerFactoryBuilder;
@@ -92,6 +89,11 @@ public class XMLQueryCompiler {
private String[] nodeList;
public XMLQueryCompiler(XQueryCompilationListener listener, String[] nodeList, int frameSize) {
+ this(listener, nodeList, frameSize, -1);
+ }
+
+ public XMLQueryCompiler(XQueryCompilationListener listener, String[] nodeList, int frameSize,
+ int availableProcessors) {
this.listener = listener == null ? NoopXQueryCompilationListener.INSTANCE : listener;
this.frameSize = frameSize;
this.nodeList = nodeList;
@@ -148,7 +150,11 @@ public class XMLQueryCompiler {
}
});
builder.setNullWriterFactory(new VXQueryNullWriterFactory());
- builder.setClusterLocations(VXQueryMetadataProvider.getClusterLocations(nodeList));
+ if (availableProcessors < 1) {
+ builder.setClusterLocations(VXQueryMetadataProvider.getClusterLocations(nodeList));
+ } else {
+ builder.setClusterLocations(VXQueryMetadataProvider.getClusterLocations(nodeList, availableProcessors));
+ }
cFactory = builder.create();
}
@@ -157,8 +163,8 @@ public class XMLQueryCompiler {
moduleNode = XMLQueryParser.parse(name, query);
listener.notifyParseResult(moduleNode);
module = new XMLQueryTranslator(ccb).translateModule(moduleNode);
- pprinter = new LogicalOperatorPrettyPrintVisitor(new VXQueryLogicalExpressionPrettyPrintVisitor(module
- .getModuleContext()));
+ pprinter = new LogicalOperatorPrettyPrintVisitor(new VXQueryLogicalExpressionPrettyPrintVisitor(
+ module.getModuleContext()));
VXQueryMetadataProvider mdProvider = new VXQueryMetadataProvider(nodeList, ccb.getSourceFileMap());
compiler = cFactory.createCompiler(module.getBody(), mdProvider, 0);
listener.notifyTranslationResult(module);