Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add qualifier to version #257

Merged
merged 4 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:

- name: Build and Run Tests
run: |
./gradlew build -Dopensearch.version=2.0.0-SNAPSHOT
./gradlew build
- name: Publish to Maven Local
run: |
./gradlew publishToMavenLocal -Dopensearch.version=2.0.0-SNAPSHOT
./gradlew publishToMavenLocal
- name: Multi Nodes Integration Testing
run: |
./gradlew integTest -PnumNodes=3
Expand Down
21 changes: 10 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ buildscript {

ext {
opensearch_group = "org.opensearch"
opensearch_version = System.getProperty("opensearch.version", "2.0.0-SNAPSHOT")
// 2.0.0-SNAPSHOT -> 2.0.0.0-SNAPSHOT
opensearch_build = opensearch_version.replaceAll(/(\.\d)([^\d]*)$/, '$1.0$2')
opensearch_version = System.getProperty("opensearch.version", "2.0.0-alpha1-SNAPSHOT")

// 2.0.0-alpha1-SNAPSHOT -> 2.0.0.0-alpha1-SNAPSHOT
version_tokens = opensearch_version.tokenize('-')
opensearch_build = version_tokens[0] + '.0'
for (int j = 1; j < version_tokens.size(); j++) {
opensearch_build = opensearch_build + '-' + version_tokens[j]
}

common_utils_version = System.getProperty("common_utils.version", opensearch_build)
}

Expand Down Expand Up @@ -43,14 +49,7 @@ ext {

allprojects {
group = 'org.opensearch'
version = opensearch_version - "-SNAPSHOT" + ".0"

if (buildVersionQualifier) {
version += "-${buildVersionQualifier}"
}
if (isSnapshot) {
version += "-SNAPSHOT"
}
version = opensearch_build

apply from: "$rootDir/build-tools/repositories.gradle"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.opensearch.client.Client;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.xcontent.XContentType;

@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
Expand Down Expand Up @@ -72,7 +71,7 @@ public boolean doesModelIndexExist() {

private void initMLIndexIfAbsent(String indexName, String mapping) {
if (!clusterService.state().metadata().hasIndex(indexName)) {
client.admin().indices().prepareCreate(indexName).addMapping("_doc", mapping, XContentType.JSON).get();
client.admin().indices().prepareCreate(indexName).get();
log.info("create index:{}", indexName);
} else {
log.info("index:{} is already created", indexName);
Expand Down Expand Up @@ -101,7 +100,7 @@ public void initMLIndexIfAbsent(String indexName, String mapping, ActionListener
log.error("Failed to create index " + indexName, e);
listener.onFailure(e);
});
CreateIndexRequest request = new CreateIndexRequest(indexName).mapping("_doc", mapping, XContentType.JSON);
CreateIndexRequest request = new CreateIndexRequest(indexName);
client.admin().indices().create(request, ActionListener.runBefore(actionListener, () -> threadContext.restore()));
} catch (Exception e) {
log.error("Failed to init index " + indexName, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
Expand Down Expand Up @@ -117,7 +117,6 @@ public void testPredictionWithDataFrame_FitRCF() {
FitRCFParams.builder().timeField(TIME_FIELD).build(),
batchRcfDataSize
);
System.out.println(dataFrame);
}

public void testPredictionWithDataFrame_LinearRegression() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import static org.opensearch.ml.utils.TestData.IRIS_DATA_SIZE;

import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.tests.util.LuceneTestCase;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.Map;

import org.junit.Ignore;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.opensearch.ml.common.FunctionName;
Expand All @@ -18,6 +19,7 @@ public class RestMLSearchTaskActionIT extends MLCommonsRestTestCase {
@Rule
public ExpectedException exceptionRule = ExpectedException.none();

@Ignore
public void testSearchTaskAPI_Success() throws IOException, InterruptedException {
trainAsyncWithSample(trainResult -> {
assertFalse(trainResult.containsKey("model_id"));
Expand Down
1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ if [ -z "$VERSION" ]; then
exit 1
fi

[[ ! -z "$QUALIFIER" ]] && VERSION=$VERSION-$QUALIFIER
[[ "$SNAPSHOT" == "true" ]] && VERSION=$VERSION-SNAPSHOT
[ -z "$OUTPUT" ] && OUTPUT=artifacts

Expand Down