Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jortiz16 committed Jan 15, 2017
1 parent 1f3649d commit 5189d2c
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 72 deletions.
10 changes: 5 additions & 5 deletions src/edu/washington/escience/myria/api/PerfEnforceResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Response getDataPreparationStatus() {
}

/**
* Returns true if the PSLA generation is finished.
* Returns true if the PSLA generation is finished.
*/
@GET
@Path("/isDonePSLA")
Expand All @@ -73,7 +73,7 @@ public Response getPSLA() throws PerfEnforceException {

/**
* Sets the tier the user decides to purchase.
*
*
* @param tier the tier selected by the user
*/
@POST
Expand All @@ -86,7 +86,7 @@ public Response setTier(@FormDataParam("tier") final int tier) {

/**
* Determines the SLA for a given query. The SLA returned is based on the tier purchased.
*
*
* @param querySQL the query from the user
*/
@POST
Expand All @@ -98,8 +98,8 @@ public Response findSLA(@FormDataParam("querySQL") final String querySQL) throws
}

/**
* Records the runtime of a query. This helps the learner adapt.
*
* Records the runtime of a query. This helps the learner adapt.
*
* @param queryRuntime the runtime of the query (in seconds).
*/
@POST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* This class is used to encode information about a
* query provided by the user. It returns a query identifier,
* the SLA for the query, and the query SQL statement.
* This class is used to encode information about a
* query provided by the user. It returns a query identifier,
* the SLA for the query, and the query SQL statement.
*
*/
public class PerfEnforceQueryMetadataEncoding {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.List;

/**
* This class encodes statistical information about a table from the user's schema.
* This class encodes statistical information about a table from the user's schema.
*/
public class PerfEnforceStatisticsEncoding {
@Required public String table_name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import edu.washington.escience.myria.io.AmazonS3Source;

/**
* This class returns an encoding describing a table's schema.
* This class returns an encoding describing a table's schema.
*/
public class PerfEnforceTableEncoding {
public RelationKey relationKey;
Expand Down
4 changes: 2 additions & 2 deletions src/edu/washington/escience/myria/io/AmazonS3Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public AmazonS3Client getS3Client() {
clientConfig.setMaxErrorRetry(3);
s3Client =
new AmazonS3Client(
new AWSCredentialsProviderChain(new AnonymousAWSCredentialsProvider(),
new DefaultAWSCredentialsProviderChain()));
new AWSCredentialsProviderChain(
new AnonymousAWSCredentialsProvider(), new DefaultAWSCredentialsProviderChain()));
}
return s3Client;
}
Expand Down
8 changes: 4 additions & 4 deletions src/edu/washington/escience/myria/parallel/Server.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edu.washington.escience.myria.parallel;
package edu.washington.escience.myria.parallel;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -1372,7 +1372,7 @@ public long persistDataset(final RelationKey relationKey)

/**
* Directly runs a command on the underlying database based on the selected workers
*
*
* @param sqlString command to run on the database
* @param workers the workers that will run the command
*/
Expand Down Expand Up @@ -1406,9 +1406,9 @@ public void executeSQLStatement(final String sqlString, final Set<Integer> worke
}

/**
* Directly runs a command on the underlying database based on the selected workers
* Directly runs a command on the underlying database based on the selected workers
* and returns the tuple results through a string array
*
*
* @param sqlString command to run on the database
* @param outputSchema the schema of the output result
* @param workers the workers that will run the command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public PerfEnforceDataPreparation(final Server server) {

/**
* Ingesting the fact table in a parallel sequence
*
*
* @param factTableDesc contains information about the fact table to ingest
*/
public HashMap<Integer, RelationKey> ingestFact(final PerfEnforceTableEncoding factTableDesc)
Expand Down Expand Up @@ -183,7 +183,7 @@ public HashMap<Integer, RelationKey> ingestFact(final PerfEnforceTableEncoding f

/**
* Ingesting dimension tables for broadcasting
*
*
* @param dimTableDesc holds information about the dimension table to ingest
*/
public void ingestDimension(final PerfEnforceTableEncoding dimTableDesc)
Expand Down Expand Up @@ -240,7 +240,7 @@ public void ingestDimension(final PerfEnforceTableEncoding dimTableDesc)

/**
* This method analyzes the given table
*
*
* @param tableToAnalyze the table to analyze
*/
public void analyzeTable(final PerfEnforceTableEncoding tableToAnalyze)
Expand All @@ -252,13 +252,13 @@ public void analyzeTable(final PerfEnforceTableEncoding tableToAnalyze)
for (Entry<Integer, RelationKey> entry : factTableRelationMapper.entrySet()) {
PerfEnforceTableEncoding temp =
new PerfEnforceTableEncoding(
tableToAnalyze.relationKey,
tableToAnalyze.type,
tableToAnalyze.source,
tableToAnalyze.schema,
tableToAnalyze.delimiter,
tableToAnalyze.keys,
tableToAnalyze.corresponding_fact_key);
tableToAnalyze.relationKey,
tableToAnalyze.type,
tableToAnalyze.source,
tableToAnalyze.schema,
tableToAnalyze.delimiter,
tableToAnalyze.keys,
tableToAnalyze.corresponding_fact_key);
temp.relationKey =
new RelationKey(
entry.getValue().getUserName(),
Expand All @@ -268,17 +268,19 @@ public void analyzeTable(final PerfEnforceTableEncoding tableToAnalyze)
}
} else {
postgresStatsAnalyzeTable(
tableToAnalyze, PerfEnforceUtils.getWorkerRangeSet(Collections.max(PerfEnforceDriver.configurations)));
tableToAnalyze,
PerfEnforceUtils.getWorkerRangeSet(Collections.max(PerfEnforceDriver.configurations)));
}
}

/**
* Helper method that runs the ANALYZE command for a set of workers
*
*
* @param tableToAnalyze the table to analyze
* @param workers the set of workers to run the ANALYZE command
*/
public void postgresStatsAnalyzeTable(final PerfEnforceTableEncoding tableToAnalyze, Set<Integer> workers)
public void postgresStatsAnalyzeTable(
final PerfEnforceTableEncoding tableToAnalyze, Set<Integer> workers)
throws DbException, InterruptedException {
for (int i = 0; i < tableToAnalyze.schema.getColumnNames().size(); i++) {
server.executeSQLStatement(
Expand All @@ -290,7 +292,8 @@ public void postgresStatsAnalyzeTable(final PerfEnforceTableEncoding tableToAnal
}
server.executeSQLStatement(
String.format(
"ANALYZE %s;", tableToAnalyze.relationKey.toString(MyriaConstants.STORAGE_SYSTEM_POSTGRESQL)),
"ANALYZE %s;",
tableToAnalyze.relationKey.toString(MyriaConstants.STORAGE_SYSTEM_POSTGRESQL)),
workers);
}

Expand Down Expand Up @@ -350,10 +353,10 @@ public void collectSelectivities() throws PerfEnforceException {

/**
* Given the primary key, this method determines which key values will return either .001%, .01% or 10% of the data.
*
*
* @param relationKey the relationkey of the table
* @param tableSize the size of the table
* @param config the cluster configuration
* @param config the cluster configuration
* @param type the type of the table -- can be either "fact" or "dimension"
* @param keys the primary keys of the relation
* @param schema the schema of the relation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final class PerfEnforceDriver {

/**
* Constructor for the PerfEnforceDriver
*
*
* @param server the instance of the server
* @param instancePath the path for the Myria deployment
*/
Expand Down Expand Up @@ -86,7 +86,7 @@ public void fetchS3Files() throws PerfEnforceException {

/**
* Prepares the PSLA given a list of tables
*
*
* @param tableList the tables from the user's dataset
*/
public void preparePSLA(List<PerfEnforceTableEncoding> tableList) throws Exception {
Expand Down Expand Up @@ -168,7 +168,7 @@ public String getPSLA() throws PerfEnforceException {

/**
* Sets the tier selected by the user
*
*
* @param tier the tier selected
*/
public void setTier(final int tier) {
Expand All @@ -177,7 +177,7 @@ public void setTier(final int tier) {

/**
* Finds the SLA for a given query
*
*
* @param querySQL the given query
*/
public void findSLA(String querySQL) throws PerfEnforceException {
Expand All @@ -187,7 +187,7 @@ public void findSLA(String querySQL) throws PerfEnforceException {

/**
* Records the runtime of a query
*
*
* @param queryRuntime the runtime of a query
*/
public void recordRealRuntime(final Double queryRuntime) throws PerfEnforceException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class PerfEnforceOnlineLearning {

/**
* The constructor for the PerfEnforceOnlineLearning class
*
*
* @param server an instance of the server class
* @param tier the tier selected by the user
*/
Expand All @@ -57,7 +57,7 @@ public PerfEnforceOnlineLearning(final Server server, final int tier) {

/**
* Replaces the query's reference to the fact table based on the current cluster configuration
*
*
* @param queryText the query that the user will run
* @param configuration the current configuration
*/
Expand All @@ -73,7 +73,7 @@ public String convertQueryForConfiguration(String queryText, int configuration)

/**
* Finds the SLA for a given query
*
*
* @param querySQL the query from the user
*/
public void findSLA(final String querySQL) throws PerfEnforceException {
Expand All @@ -83,7 +83,8 @@ public void findSLA(final String querySQL) throws PerfEnforceException {
String currentQueryForConfiguration =
convertQueryForConfiguration(querySQL, currentConfigurationSize);
String currentQueryFeatures =
PerfEnforceUtils.getMaxFeature(server, currentQueryForConfiguration, currentConfigurationSize);
PerfEnforceUtils.getMaxFeature(
server, currentQueryForConfiguration, currentConfigurationSize);

try {
PrintWriter featureWriter =
Expand Down Expand Up @@ -225,15 +226,15 @@ public void run() {

/**
* Given a configuration size, this method predicts the runtime of the currentQuery
*
* @param configurationIndex the configuration size in consideration
*
* @param configurationIndex the configuration size in consideration
*/
public void trainOnlineQueries(final int configurationIndex)
throws PerfEnforceException {
public void trainOnlineQueries(final int configurationIndex) throws PerfEnforceException {
String MOAFileName = Paths.get(onlineLearningPath, "moa.jar").toString();
String trainingFileName = Paths.get(onlineLearningPath, "training.arff").toString();
String modifiedTrainingFileName =
Paths.get(onlineLearningPath, "training-modified-" + configurationIndex + ".arff").toString();
Paths.get(onlineLearningPath, "training-modified-" + configurationIndex + ".arff")
.toString();
String predictionsFileName =
Paths.get(onlineLearningPath, "predictions" + configurationIndex + ".txt").toString();

Expand Down Expand Up @@ -282,7 +283,7 @@ public void trainOnlineQueries(final int configurationIndex)

/**
* Helps parse the output file from MOA to read the runtime prediction
*
*
* @param configurationIndex the configuration size in consideration
* @param predictionFileName the file that contains the prediction
*/
Expand All @@ -302,15 +303,13 @@ public void parsingOnlineFile(final int configurationIndex, final String predict
}
}


/**
* Returns features for a particular query
*
*
* @param configurationIndex the configuration size in consideration
* @param queryRuntime the runtime of the query
*/
public String getQueryFeature(
final int configurationIndex, final double queryRuntime)
public String getQueryFeature(final int configurationIndex, final double queryRuntime)
throws PerfEnforceException {
String featureFilePath =
Paths.get(
Expand Down Expand Up @@ -349,7 +348,7 @@ public String getQueryFeature(

/**
* Returns a score to determine the distance between the real runtime and the SLA runtime
*
*
* @param ratio the ratio between the real runtime and the SLA runtime
*/
public double closeToOneScore(final double ratio) {
Expand All @@ -362,34 +361,34 @@ public double closeToOneScore(final double ratio) {

/**
* Records the real runtime of the query. Used for learning.
*
*
* @param queryRuntime the runtime of the query
*/
public void recordRealRuntime(final double queryRuntime) throws PerfEnforceException {
previousDataPoints.add(
getQueryFeature(
PerfEnforceDriver.configurations.indexOf(currentConfiguration), queryRuntime));
PerfEnforceDriver.configurations.indexOf(currentConfiguration), queryRuntime));
}

/**
* Returns metadata about the current query
*
*
*/
public PerfEnforceQueryMetadataEncoding getCurrentQuery() {
return currentQuery;
}

/**
* Gets the current cluster size
*
*
*/
public int getClusterSize() {
return currentConfiguration;
}

/**
* Returns the tier selected by the user
*
*
*/
public int getSelectedTier() {
return selectedTier;
Expand Down

0 comments on commit 5189d2c

Please sign in to comment.