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

[Plugin]Add simple NFS job #2358

Merged
merged 8 commits into from
Mar 20, 2019
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
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,9 @@ matrix:
before_install: cd contrib/submit-simple-job
install: npm install
script: npm test

- language: node_js
node_js: node
before_install: cd contrib/submit-nfs-job
install: yarn --frozen-lockfiles
script: yarn build
14 changes: 14 additions & 0 deletions contrib/submit-nfs-job/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80

[*.md]
indent_size = 4
trim_trailing_whitespace = false
64 changes: 64 additions & 0 deletions contrib/submit-nfs-job/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# distributed files
/dist
72 changes: 72 additions & 0 deletions contrib/submit-nfs-job/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Submit NFS Job Plugin

A web portal plugin to submit job with data on NFS.

## Build

```bash
git clone https://github.com/Microsoft/pai.git
cd pai/contrib/submit-nfs-job
yarn
yarn build
```

The built file will be located in `dist/plugin.js`.

## Deploy

Put the built plugin file to a static file server that is accessible by the user.

Read [PLUGINS](../../docs/webportal/PLUGINS.md#publish) for details.

## Install

Append the following plugin configuration to the `webportal.plugins` section of `service-configuration.yaml` file.

```yaml
webportal:
plugins:
- id: submit-nfs-job
title: Submit NFS Job
uri: # URL of the deployed plugin file.
```

## Storage Preparation

See <https://github.com/Microsoft/pai/wiki/Simplified-Job-Submission-for-OpenPAI-with-NFS-deployment>

## Develop

```bash
git clone https://github.com/Microsoft/pai.git
cd pai/contrib/submit-nfs-job
yarn
yarn start
```

Configure the plugin of webportal env file with the uri `http://localhost:8080/plugin.js`.

## License

Copyright (c) Microsoft Corporation
All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
42 changes: 42 additions & 0 deletions contrib/submit-nfs-job/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "simple-nfs-job",
"version": "1.0.0",
"description": "A web portal plugin to submit job with data on NFS.",
"main": "src/index.ts",
"scripts": {
"start": "webpack-dev-server --mode=development",
"prebuild": "tslint --project .",
"build": "webpack --mode=production"
},
"author": "Microsoft Corporation (https://microsoft.com/)",
"repository": {
"type": "git",
"url": "git+https://github.com/Microsoft/pai.git"
},
"bugs": {
"url": "https://github.com/Microsoft/pai/issues"
},
"homepage": "https://github.com/Microsoft/pai#readme",
"license": "MIT",
"dependencies": {
"lodash.get": "^4.4.2",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
"@types/lodash.get": "^4.4.6",
"@types/react": "^16.8.7",
"@types/react-dom": "^16.8.2",
"@types/webpack": "^4.4.25",
"@types/webpack-dev-server": "^3.1.4",
"ts-loader": "^5.3.3",
"ts-node": "^8.0.3",
"tslint": "^5.13.1",
"tslint-react": "^3.6.0",
"typescript": "^3.3.3333",
"webpack": "^4.29.6",
"webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.2.1"
}
}
27 changes: 27 additions & 0 deletions contrib/submit-nfs-job/src/App/Context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* Copyright (c) Microsoft Corporation
* All rights reserved.
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import { createContext } from "react";

export default createContext({ user: "", api: "", token: "" });
30 changes: 30 additions & 0 deletions contrib/submit-nfs-job/src/App/Job.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*!
* Copyright (c) Microsoft Corporation
* All rights reserved.
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import MountDirectories from "./MountDirectories";

export default abstract class Job {
public readonly mountDirectories: MountDirectories | null = null;
public abstract convert(): any;
}
Loading