This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SUBMARINE-558. Define Swagger API for pre-defined template submission
### What is this PR for? Make basic rest api for submi template. Convert submitted template to experiment post http://localhost/V1/template/submit ### What type of PR is it? [Bug Fix | Improvement | Feature | Documentation | Hot Fix | Refactoring] ### Todos * [x] - API * [x] - test ### What is the Jira issue? https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-558 ### How should this be tested? ```sh # Register experiment template curl -X POST -H "Content-Type: application/json" -d ' { "name": "tf-mnist-test", "author": "author", "description": "This is a template to run tf-mnist\n", "parameters": [ { "name": "training.learning_rate", "value": 0.1, "required": true, "description": " mnist learning_rate " }, { "name": "training.batch_size", "value": 150, "required": false, "description": "This is batch size of training" } ], "experimentSpec": { "meta": { "cmd": "python /var/tf_mnist/mnist_with_summaries.py --log_dir=/train/log --learning_rate={{training.learning_rate}} --batch_size={{training.batch_size}}", "name": "tf-mnist-template-test", "envVars": { "ENV1": "ENV1" }, "framework": "TensorFlow", "namespace": "default" }, "spec": { "Ps": { "replicas": 1, "resources": "cpu=1,memory=1024M" }, "Worker": { "replicas": 1, "resources": "cpu=1,memory=1024M" } }, "environment": { "image": "gcr.io/kubeflow-ci/tf-mnist-with-summaries:1.0" } } } ' http://127.0.0.1:8080/api/v1/template ``` ```sh # Submit experiment template to experiment curl -X POST -H "Content-Type: application/json" -d ' { "name": "tf-mnist-test", "params": { "training.learning_rate":"0.01", "training.batch_size":"150" } } ' http://127.0.0.1:8080/api/v1/template/submit ``` If the submission is successful, it will return ```json { "status": "OK", "code": 200, "success": true, "message": null, "result": { "experimentId": "experiment_1597853926000_0035", "name": "tf-mnist-template-test", "uid": "0a79d641-871e-4ba6-9e3e-eab1d4690f4e", "status": "Accepted", "acceptedTime": "2020-08-22T18:36:32.000+08:00", "createdTime": null, "runningTime": null, "finishedTime": null, "spec": { "meta": { "name": "tf-mnist-template-test", "namespace": "default", "framework": "TensorFlow", "cmd": "python /var/tf_mnist/mnist_with_summaries.py --log_dir=/train/log --learning_rate=0.01 --batch_size=150", "envVars": { "ENV1": "ENV1" } }, "environment": { "name": null, "dockerImage": null, "kernelSpec": null, "description": null, "image": "gcr.io/kubeflow-ci/tf-mnist-with-summaries:1.0" }, "spec": { "Ps": { "replicas": 1, "resources": "cpu=1,memory=1024M", "name": null, "image": null, "cmd": null, "envVars": null, "resourceMap": { "memory": "1024M", "cpu": "1" } }, "Worker": { "replicas": 1, "resources": "cpu=1,memory=1024M", "name": null, "image": null, "cmd": null, "envVars": null, "resourceMap": { "memory": "1024M", "cpu": "1" } } } } }, "attributes": {} } ``` ### Screenshots (if appropriate) ![image](https://user-images.githubusercontent.com/19265751/90865269-b64fce00-e3c4-11ea-8e9e-6f3a3a24c892.png) ### Questions: * Does the licenses files need update? Yes/No * Is there breaking changes for older versions? Yes/No * Does this needs documentation? Yes/No Author: JohnTing <jot.johnting@gmail.com> Closes #382 from JohnTing/SUBMARINE-558 and squashes the following commits: 1ea2588 [JohnTing] change e98083b [JohnTing] change b7b6dd4 [JohnTing] ExperimentAndTemplateMixed api eca2ec3 [JohnTing] change3 b358d3b [JohnTing] change3 6a4bad2 [JohnTing] change2 7fc82ef [JohnTing] change 27a86f3 [JohnTing] Update submarine-test/test-k8s/src/test/java/org/apache/submarine/rest/ExperimentTemplateManagerRestApiIT.java 1de1d4f [JohnTing] Update submarine-server/server-core/src/main/java/org/apache/submarine/server/experimenttemplate/ExperimentTemplateManager.java 386ff82 [JohnTing] Update submarine-server/server-core/src/main/java/org/apache/submarine/server/experimenttemplate/ExperimentTemplateManager.java a28d1a5 [JohnTing] Update submarine-server/server-core/src/main/java/org/apache/submarine/server/experimenttemplate/ExperimentTemplateManager.java e11a097 [JohnTing] add simple doc 64cc6a7 [JohnTing] test1 5060482 [JohnTing] Add testList, testUpdate 4b264cb [JohnTing] usable
- Loading branch information