Removed createJob. startJob serves as the single call to create and start a job
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_hyracks_scheduling@431 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
index 61786d3..eae4c46 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
@@ -555,9 +555,8 @@
DisplayFormat pdf) throws Exception {
for (int i = 0; i < specs.length; i++) {
specs[i].setMaxReattempts(0);
- JobId jobId = hcc.createJob(GlobalConfig.HYRACKS_APP_NAME, specs[i]);
+ JobId jobId = hcc.startJob(GlobalConfig.HYRACKS_APP_NAME, specs[i]);
long startTime = System.currentTimeMillis();
- hcc.start(jobId);
hcc.waitForCompletion(jobId);
long endTime = System.currentTimeMillis();
double duration = (endTime - startTime) / 1000.00;
@@ -570,10 +569,9 @@
throws Exception {
for (int i = 0; i < jobs.length; i++) {
jobs[i].getJobSpec().setMaxReattempts(0);
- JobId jobId = hcc.createJob(GlobalConfig.HYRACKS_APP_NAME, jobs[i].getJobSpec());
long startTime = System.currentTimeMillis();
try {
- hcc.start(jobId);
+ JobId jobId = hcc.startJob(GlobalConfig.HYRACKS_APP_NAME, jobs[i].getJobSpec());
if (jobs[i].getSubmissionMode() == SubmissionMode.ASYNCHRONOUS) {
continue;
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
index 5f4c189..83e9991 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -84,9 +84,8 @@
}
public static void runJob(JobSpecification spec) throws Exception {
- JobId jobId = hcc.createJob(GlobalConfig.HYRACKS_APP_NAME, spec, EnumSet.of(JobFlag.PROFILE_RUNTIME));
GlobalConfig.ASTERIX_LOGGER.info(spec.toJSON().toString());
- hcc.start(jobId);
+ JobId jobId = hcc.startJob(GlobalConfig.HYRACKS_APP_NAME, spec, EnumSet.of(JobFlag.PROFILE_RUNTIME));
GlobalConfig.ASTERIX_LOGGER.info(jobId.toString());
hcc.waitForCompletion(jobId);
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/DdlTranslator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/DdlTranslator.java
index 5e891c8..864e34a 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/DdlTranslator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/aql/translator/DdlTranslator.java
@@ -133,20 +133,20 @@
compiledDeclarations.connectToDataverse(dataverseName);
break;
}
-
+
case CREATE_DATAVERSE: {
checkForDataverseConnection(false);
CreateDataverseStatement stmtCreateDataverse = (CreateDataverseStatement) stmt;
String dvName = stmtCreateDataverse.getDataverseName().getValue();
Dataverse dv = MetadataManager.INSTANCE.getDataverse(mdTxnCtx, dvName);
if (dv != null && !stmtCreateDataverse.getIfNotExists()) {
- throw new AlgebricksException("A dataverse with this name " + dvName + " already exists.");
+ throw new AlgebricksException("A dataverse with this name " + dvName + " already exists.");
}
MetadataManager.INSTANCE.addDataverse(mdTxnCtx,
- new Dataverse(dvName, stmtCreateDataverse.getFormat()));
+ new Dataverse(dvName, stmtCreateDataverse.getFormat()));
break;
}
-
+
case DATASET_DECL: {
checkForDataverseConnection(true);
DatasetDecl dd = (DatasetDecl) stmt;
@@ -158,7 +158,7 @@
datasetName);
if (ds != null) {
if (dd.getIfNotExists()) {
- continue;
+ continue;
} else {
throw new AlgebricksException("A dataset with this name " + datasetName
+ " already exists.");
@@ -213,9 +213,8 @@
break;
}
}
- MetadataManager.INSTANCE.addDataset(mdTxnCtx,
- new Dataset(compiledDeclarations.getDataverseName(), datasetName, itemTypeName,
- datasetDetails, dsType));
+ MetadataManager.INSTANCE.addDataset(mdTxnCtx, new Dataset(compiledDeclarations.getDataverseName(),
+ datasetName, itemTypeName, datasetDetails, dsType));
if (dd.getDatasetType() == DatasetType.INTERNAL || dd.getDatasetType() == DatasetType.FEED) {
runCreateDatasetJob(hcc, datasetName);
}
@@ -245,7 +244,7 @@
datasetName, indexName, stmtCreateIndex.getIndexType(),
stmtCreateIndex.getFieldExprs(), false));
runCreateIndexJob(hcc, stmtCreateIndex);
- }
+ }
break;
}
case TYPE_DECL: {
@@ -256,8 +255,7 @@
compiledDeclarations.getDataverseName(), typeName);
if (dt != null) {
if (!stmtCreateType.getIfNotExists())
- throw new AlgebricksException("A datatype with this name " + typeName
- + " already exists.");
+ throw new AlgebricksException("A datatype with this name " + typeName + " already exists.");
} else {
if (builtinTypeMap.get(typeName) != null) {
throw new AlgebricksException("Cannot redefine builtin type " + typeName + ".");
@@ -403,8 +401,7 @@
NodeGroup ng = MetadataManager.INSTANCE.getNodegroup(mdTxnCtx, nodegroupName);
if (ng == null) {
if (!stmtDelete.getIfExists())
- throw new AlgebricksException("There is no nodegroup with this name " + nodegroupName
- + ".");
+ throw new AlgebricksException("There is no nodegroup with this name " + nodegroupName + ".");
} else
MetadataManager.INSTANCE.dropNodegroup(mdTxnCtx, nodegroupName);
break;
@@ -412,8 +409,9 @@
case CREATE_FUNCTION: {
CreateFunctionStatement cfs = (CreateFunctionStatement) stmt;
- Function function = new Function(compiledDeclarations.getDataverseName(), cfs.getFunctionIdentifier().getFunctionName(),
- cfs.getFunctionIdentifier().getArity(), cfs.getParamList(), cfs.getFunctionBody());
+ Function function = new Function(compiledDeclarations.getDataverseName(), cfs
+ .getFunctionIdentifier().getFunctionName(), cfs.getFunctionIdentifier().getArity(),
+ cfs.getParamList(), cfs.getFunctionBody());
try {
FunctionUtils.getFunctionDecl(function);
} catch (Exception e) {
@@ -474,8 +472,7 @@
DisplayFormat pdf) throws Exception {
for (int i = 0; i < specs.length; i++) {
specs[i].setMaxReattempts(0);
- JobId jobId = hcc.createJob(GlobalConfig.HYRACKS_APP_NAME, specs[i]);
- hcc.start(jobId);
+ JobId jobId = hcc.startJob(GlobalConfig.HYRACKS_APP_NAME, specs[i]);
hcc.waitForCompletion(jobId);
}
}
@@ -484,7 +481,7 @@
AlgebricksException, Exception {
runJob(hcc, DatasetOperations.createDatasetJobSpec(datasetName, compiledDeclarations));
}
-
+
private void runCreateIndexJob(IHyracksClientConnection hcc, CreateIndexStatement stmtCreateIndex) throws Exception {
// TODO: Eventually CreateIndexStatement and CompiledCreateIndexStatement should be replaced by the corresponding metadata entity.
// For now we must still convert to a CompiledCreateIndexStatement here.
@@ -499,7 +496,7 @@
}
runJob(hcc, spec);
}
-
+
private void compileDatasetDropStatement(IHyracksClientConnection hcc, MetadataTransactionContext mdTxnCtx,
String datasetName) throws Exception {
CompiledDatasetDropStatement cds = new CompiledDatasetDropStatement(datasetName);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestKeywordIndexJob.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestKeywordIndexJob.java
index f755752..d106ddd 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestKeywordIndexJob.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestKeywordIndexJob.java
@@ -218,10 +218,9 @@
TestKeywordIndexJob tij = new TestKeywordIndexJob();
JobSpecification jobSpec = tij.createJobSpec();
- JobId jobId = hcc.createJob("asterix", jobSpec);
long start = System.currentTimeMillis();
- hcc.start(jobId);
+ JobId jobId = hcc.startJob("asterix", jobSpec);
hcc.waitForCompletion(jobId);
long end = System.currentTimeMillis();
System.err.println(start + " " + end + " " + (end - start));
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestSecondaryIndexJob.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestSecondaryIndexJob.java
index 17d8c9f..4c7e46e 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestSecondaryIndexJob.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/TestSecondaryIndexJob.java
@@ -218,10 +218,9 @@
TestSecondaryIndexJob tij = new TestSecondaryIndexJob();
JobSpecification jobSpec = tij.createJobSpec();
- JobId jobId = hcc.createJob("asterix", jobSpec);
long start = System.currentTimeMillis();
- hcc.start(jobId);
+ JobId jobId = hcc.startJob("asterix", jobSpec);
hcc.waitForCompletion(jobId);
long end = System.currentTimeMillis();
System.err.println(start + " " + end + " " + (end - start));