Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
SUBMARINE-1255. Add XGBoost support to MLJob
Browse files Browse the repository at this point in the history
### What is this PR for?
Add XGBoost support to MLJob

### What type of PR is it?
Feature

### Todos
* [x]  update ExperimentSpecParser
* [x]  create XGBoost Folder in Model Folder
* [ ]  add XGBoost button in Workbench

### What is the Jira issue?
https://issues.apache.org/jira/browse/SUBMARINE-1255

### How should this be tested?

### Screenshots (if appropriate)

### Questions:
* Do the license files need updating? No
* Are there breaking changes for older versions? No
* Does this need new documentation? No

Author: Kevin Su <[email protected]>
Author: JackLiu00521 <[email protected]>

Signed-off-by: Kevin <[email protected]>

Closes #939 from JackLiu00521/SUBMARINE-1255 and squashes the following commits:

a2f0b2a [Kevin Su] Fixed tests
c270fd3 [Kevin Su] Fixed tests
02b75b8 [Kevin Su] Fixed tests
f3ba3e1 [Kevin Su] Fixed tests
4eab29b [Kevin Su] Fixed tests
edc1da7 [Kevin Su] Fixed tests
e30c6e0 [Kevin Su] Fixed tests
832c553 [Kevin Su] Fixed tests
40484fd [Kevin Su] Fixed tests
b29b559 [Kevin Su] Fixed tests
b8ad1d8 [Kevin Su] Fixed tests
778b6ba [Kevin Su] Merge branch 'master' of github.com:apache/submarine into SUBMARINE-1255
f47dfdf [Kevin Su] Fixed tests
c5ebd47 [JackLiu00521] Merge pull request #3 from pingsutw/939
30b6961 [Kevin Su] Few updates
304724c [Kevin Su] Few updates
785ce9b [JackLiu00521] fix errors
41d24f0 [JackLiu00521] 20220627 temp commit
301b210 [JackLiu00521] temp commit
5feb168 [JackLiu00521] temp commit before buidl
85435bb [JackLiu00521] SUBMARINE-1255. update experimentSpectParserTest
8625ed0 [JackLiu00521] update indentation
d24aad8 [JackLiu00521] update parseXGBoostJobSpec
bca3c60 [JackLiu00521] add xgboost model, update parser
830ab55 [JackLiu00521] commit after fetch upstream
  • Loading branch information
pingsutw committed Jun 29, 2022
1 parent 4ab1cd9 commit e7ed4a5
Show file tree
Hide file tree
Showing 24 changed files with 511 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ jobs:
TEST_MODULES: "-pl :submarine-server-database"
run: |
echo ">>> mvn $TEST_FLAG $TEST_MODULES -B"
mvn $TEST_FLAG $TEST_MODULES -B
mvn $TEST_FLAG $TEST_MODULES -B
- name: Build submarine-server-database
env:
MODULES: "-pl :submarine-server-core"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade pip
pip install -r ./dev-support/style-check/python/lint-requirements.txt
pip install -r ./dev-support/style-check/python/mypy-requirements.txt
- name: Check python sdk code style
Expand All @@ -51,7 +51,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install requirements
run: |
pip install --upgrade pip
pip install --upgrade pip
pip install -r ./submarine-sdk/pysubmarine/github-actions/test-requirements.txt
- name: Install pysubmarine with tf1 and pytorch
if: matrix.tf-version == '1.15.0'
Expand Down
1 change: 1 addition & 0 deletions helm-charts/submarine/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ rules:
- notebooks
- pytorchjobs
- tfjobs
- xgboostjobs
verbs:
- "*"
- apiGroups:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<version>0.8.7</version>
<configuration>
<destFile>${basedir}/target/jacoco.exec</destFile>
<dataFile>${basedir}/target/jacoco.exec</dataFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ rules:
- tfjobs/status
- pytorchjobs
- pytorchjobs/status
- xgboostjobs
- xgboostjobs/status
- notebooks
- notebooks/status
verbs:
Expand Down Expand Up @@ -41,4 +43,4 @@ subjects:
roleRef:
kind: Role
name: "submarine-observer"
apiGroup: rbac.authorization.k8s.io
apiGroup: rbac.authorization.k8s.io
4 changes: 4 additions & 0 deletions submarine-cloud-v2/artifacts/submarine/submarine-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ rules:
- tfjobs/status
- pytorchjobs
- pytorchjobs/status
- xgboostjobs
- xgboostjobs/status
- notebooks
- notebooks/status
verbs:
Expand Down Expand Up @@ -112,6 +114,8 @@ rules:
- tfjobs/status
- pytorchjobs
- pytorchjobs/status
- xgboostjobs
- xgboostjobs/status
- notebooks
- notebooks/status
verbs:
Expand Down
2 changes: 2 additions & 0 deletions submarine-cloud-v3/artifacts/submarine-observer-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ rules:
- tfjobs/status
- pytorchjobs
- pytorchjobs/status
- xgboostjobs
- xgboostjobs/status
- notebooks
- notebooks/status
verbs:
Expand Down
4 changes: 4 additions & 0 deletions submarine-cloud-v3/artifacts/submarine-server-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ rules:
- tfjobs/status
- pytorchjobs
- pytorchjobs/status
- xgboostjobs
- xgboostjobs/status
- notebooks
- notebooks/status
verbs:
Expand Down Expand Up @@ -110,6 +112,8 @@ rules:
- tfjobs/status
- pytorchjobs
- pytorchjobs/status
- xgboostjobs
- xgboostjobs/status
- notebooks
- notebooks/status
verbs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
package org.apache.submarine.server.api.common;

public enum CustomResourceType {
TFJob("TFJob"), PyTorchJob("PyTorchJob"), Notebook("Notebook");
TFJob("TFJob"), PyTorchJob("PyTorchJob"), XGBoost("XGBoost"), Notebook("Notebook");
private String customResourceType;

CustomResourceType(String customResourceType) {
this.customResourceType = customResourceType;
this.customResourceType = customResourceType;
}

public String getCustomResourceType() {
return this.customResourceType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public void setTags(List<String> tags) {
*/
public enum SupportedMLFramework {
TENSORFLOW("tensorflow"),
PYTORCH("pytorch");
PYTORCH("pytorch"),
XGBOOST("xgboost");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ExperimentTaskSpec {
private String cmd;
private Map<String, String> envVars;

// should ignored in JSON Serialization
// should be ignored in JSON Serialization
private Map<String, String> resourceMap;

public ExperimentTaskSpec() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,38 +38,40 @@ public class InternalServiceManager {
private static volatile InternalServiceManager internalServiceManager;
private static final Logger LOG = LoggerFactory.getLogger(InternalServiceManager.class);
private final ExperimentService experimentService;
private final NotebookService notebookService;
private final NotebookService notebookService;

public static InternalServiceManager getInstance() {
if (internalServiceManager == null) {
internalServiceManager = new InternalServiceManager(new ExperimentService(), new NotebookService());
}
return internalServiceManager;
}

@VisibleForTesting
protected InternalServiceManager(ExperimentService experimentService, NotebookService notebookService) {
this.experimentService = experimentService;
this.notebookService = notebookService;
}

public boolean updateCRStatus(CustomResourceType crType, String resourceId,
Map<String, Object> updateObject) {
if (crType.equals(CustomResourceType.Notebook)) {
return updateNotebookStatus(resourceId, updateObject);
} else if (crType.equals(CustomResourceType.TFJob) || crType.equals(CustomResourceType.PyTorchJob)) {
} else if (crType.equals(CustomResourceType.TFJob)
|| crType.equals(CustomResourceType.PyTorchJob)
|| crType.equals(CustomResourceType.XGBoost)) {
return updateExperimentStatus(resourceId, updateObject);
}
return false;
}

private boolean updateExperimentStatus(String resourceId, Map<String, Object> updateObject) {
ExperimentEntity experimentEntity = experimentService.select(resourceId);
if (experimentEntity == null) {
throw new SubmarineRuntimeException(Status.NOT_FOUND.getStatusCode(),
String.format("cannot find experiment with id:%s", resourceId));
}

if (updateObject.get("status") != null) {
experimentEntity.setExperimentStatus(updateObject.get("status").toString());
}
Expand All @@ -79,35 +81,35 @@ private boolean updateExperimentStatus(String resourceId, Map<String, Object> up
}
if (updateObject.get("createdTime") != null) {
experimentEntity.setCreateTime(
DateTime.parse(updateObject.get("createdTime").toString()).toDate());
DateTime.parse(updateObject.get("createdTime").toString()).toDate());
}
if (updateObject.get("runningTime") != null) {
experimentEntity.setRunningTime(
DateTime.parse(updateObject.get("runningTime").toString()).toDate());
DateTime.parse(updateObject.get("runningTime").toString()).toDate());
}
if (updateObject.get("finishedTime") != null) {
experimentEntity.setFinishedTime(
DateTime.parse(updateObject.get("finishedTime").toString()).toDate());
DateTime.parse(updateObject.get("finishedTime").toString()).toDate());
}

return experimentService.update(experimentEntity);
}

private boolean updateNotebookStatus(String resourceId, Map<String, Object> updateObject) {
Notebook notebook = notebookService.select(resourceId);
if (notebook == null) {
throw new SubmarineRuntimeException(Status.NOT_FOUND.getStatusCode(),
String.format("cannot find notebook with id:%s", resourceId));
}

if (updateObject.containsKey("status")) {
notebook.setStatus(updateObject.get("status").toString());
}

if (updateObject.get("createTime") != null) {
notebook.setCreatedTime(updateObject.get("createTime").toString());
}

if (updateObject.get("deletedTime") != null) {
notebook.setDeletedTime(updateObject.get("deletedTime").toString());
}
Expand Down
Loading

0 comments on commit e7ed4a5

Please sign in to comment.