-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* memory structures, index handlers * MLIndicesHandler and UT * move indexHandler from plugin to algorithm * address comments * address more comments * revert previous commit * fix buges --------- Signed-off-by: Jing Zhang <[email protected]> Co-authored-by: Jing Zhang <[email protected]>
- Loading branch information
Showing
46 changed files
with
1,106 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,11 @@ | |
//TODO: cleanup gradle config file, some overlap | ||
plugins { | ||
id 'java' | ||
id 'com.github.johnrengelman.shadow' | ||
id 'jacoco' | ||
id "io.freefair.lombok" | ||
id 'maven-publish' | ||
id 'signing' | ||
} | ||
|
||
dependencies { | ||
|
@@ -21,6 +24,15 @@ dependencies { | |
compileOnly group: 'org.apache.commons', name: 'commons-text', version: '1.10.0' | ||
compileOnly group: 'com.google.code.gson', name: 'gson', version: '2.10.1' | ||
compileOnly group: 'org.json', name: 'json', version: '20231013' | ||
|
||
implementation('com.google.guava:guava:32.1.2-jre') { | ||
exclude group: 'com.google.guava', module: 'failureaccess' | ||
exclude group: 'com.google.code.findbugs', module: 'jsr305' | ||
exclude group: 'org.checkerframework', module: 'checker-qual' | ||
exclude group: 'com.google.errorprone', module: 'error_prone_annotations' | ||
exclude group: 'com.google.j2objc', module: 'j2objc-annotations' | ||
exclude group: 'com.google.guava', module: 'listenablefuture' | ||
} | ||
} | ||
|
||
lombok { | ||
|
@@ -53,3 +65,75 @@ jacocoTestCoverageVerification { | |
dependsOn jacocoTestReport | ||
} | ||
check.dependsOn jacocoTestCoverageVerification | ||
|
||
shadowJar { | ||
destinationDirectory = file("${project.buildDir}/distributions") | ||
archiveClassifier.set(null) | ||
exclude 'META-INF/maven/com.google.guava/**' | ||
exclude 'com/google/thirdparty/**' | ||
relocate 'com.google.common', 'org.opensearch.ml.repackage.com.google.common' // dependency of cron-utils | ||
} | ||
|
||
jar { | ||
enabled false | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
archiveClassifier.set 'sources' | ||
from sourceSets.main.allJava | ||
} | ||
|
||
task javadocJar(type: Jar) { | ||
archiveClassifier.set 'javadoc' | ||
from javadoc.destinationDir | ||
dependsOn javadoc | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = 'staging' | ||
url = "${rootProject.buildDir}/local-staging-repo" | ||
} | ||
maven { | ||
name = "Snapshots" // optional target repository name | ||
url = "https://aws.oss.sonatype.org/content/repositories/snapshots" | ||
credentials { | ||
username "$System.env.SONATYPE_USERNAME" | ||
password "$System.env.SONATYPE_PASSWORD" | ||
} | ||
} | ||
} | ||
publications { | ||
shadow(MavenPublication) { publication -> | ||
project.shadow.component(publication) | ||
artifact sourcesJar | ||
artifact javadocJar | ||
|
||
pom { | ||
name = "OpenSearch ML Commons Comm" | ||
packaging = "jar" | ||
url = "https://github.com/opensearch-project/ml-commons" | ||
description = "OpenSearch ML Common" | ||
scm { | ||
connection = "scm:[email protected]:opensearch-project/ml-commons.git" | ||
developerConnection = "scm:[email protected]:opensearch-project/ml-commons.git" | ||
url = "[email protected]:opensearch-project/ml-commons.git" | ||
} | ||
licenses { | ||
license { | ||
name = "The Apache License, Version 2.0" | ||
url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
developers { | ||
developer { | ||
name = "OpenSearch" | ||
url = "https://github.com/opensearch-project/ml-commons" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
publishShadowPublicationToMavenLocal.mustRunAfter shadowJar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
ml-algorithms/src/main/java/org/opensearch/ml/engine/memory/BaseMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.ml.engine.memory; | ||
|
||
import java.io.IOException; | ||
|
||
import org.opensearch.core.xcontent.ToXContentObject; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
import org.opensearch.ml.common.spi.memory.Message; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
public class BaseMessage implements Message, ToXContentObject { | ||
|
||
@Getter | ||
@Setter | ||
protected String type; | ||
@Getter | ||
@Setter | ||
protected String content; | ||
|
||
@Builder | ||
public BaseMessage(String type, String content) { | ||
this.type = type; | ||
this.content = content; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return type + ": " + content; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
builder.startObject(); | ||
builder.field("type", type); | ||
builder.field("content", content); | ||
builder.endObject(); | ||
return builder; | ||
} | ||
} |
Oops, something went wrong.