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

Commit b7b5992

Browse files
committed
add jobs machineTypes method
1 parent 56f8c1f commit b7b5992

File tree

3 files changed

+213
-0
lines changed

3 files changed

+213
-0
lines changed

docs/jobs_machineTypes.js.html

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>jobs/machineTypes.js - Documentation</title>
6+
7+
<script src="scripts/prettify/prettify.js"></script>
8+
<script src="scripts/prettify/lang-css.js"></script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
14+
</head>
15+
<body>
16+
17+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
18+
<label for="nav-trigger" class="navicon-button x">
19+
<div class="navicon"></div>
20+
</label>
21+
22+
<label for="nav-trigger" class="overlay"></label>
23+
24+
<nav>
25+
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="jobs.html">jobs</a><ul class='methods'><li data-type='method'><a href="jobs.html#.artifactsDestroy">artifactsDestroy</a></li><li data-type='method'><a href="jobs.html#.artifactsGet">artifactsGet</a></li><li data-type='method'><a href="jobs.html#.artifactsList">artifactsList</a></li><li data-type='method'><a href="jobs.html#.clone">clone</a></li><li data-type='method'><a href="jobs.html#.create">create</a></li><li data-type='method'><a href="jobs.html#.destroy">destroy</a></li><li data-type='method'><a href="jobs.html#.list">list</a></li><li data-type='method'><a href="jobs.html#.logs">logs</a></li><li data-type='method'><a href="jobs.html#.machineTypes">machineTypes</a></li><li data-type='method'><a href="jobs.html#.show">show</a></li><li data-type='method'><a href="jobs.html#.stop">stop</a></li><li data-type='method'><a href="jobs.html#.waitfor">waitfor</a></li></ul></li><li><a href="login.html">login</a><ul class='methods'><li data-type='method'><a href="login.html#.user">user</a></li></ul></li><li><a href="logout.html">logout</a><ul class='methods'><li data-type='method'><a href="logout.html#.user">user</a></li></ul></li><li><a href="machines.html">machines</a><ul class='methods'><li data-type='method'><a href="machines.html#.availability">availability</a></li><li data-type='method'><a href="machines.html#.create">create</a></li><li data-type='method'><a href="machines.html#.destroy">destroy</a></li><li data-type='method'><a href="machines.html#.list">list</a></li><li data-type='method'><a href="machines.html#.restart">restart</a></li><li data-type='method'><a href="machines.html#.show">show</a></li><li data-type='method'><a href="machines.html#.start">start</a></li><li data-type='method'><a href="machines.html#.stop">stop</a></li><li data-type='method'><a href="machines.html#.update">update</a></li><li data-type='method'><a href="machines.html#.utilization">utilization</a></li><li data-type='method'><a href="machines.html#.waitfor">waitfor</a></li></ul></li><li><a href="networks.html">networks</a><ul class='methods'><li data-type='method'><a href="networks.html#.list">list</a></li></ul></li><li><a href="project.html">project</a><ul class='methods'><li data-type='method'><a href="project.html#.clear">clear</a></li><li data-type='method'><a href="project.html#.init">init</a></li><li data-type='method'><a href="project.html#.show">show</a></li></ul></li><li><a href="scripts.html">scripts</a><ul class='methods'><li data-type='method'><a href="scripts.html#.create">create</a></li><li data-type='method'><a href="scripts.html#.destroy">destroy</a></li><li data-type='method'><a href="scripts.html#.list">list</a></li><li data-type='method'><a href="scripts.html#.show">show</a></li><li data-type='method'><a href="scripts.html#.text">text</a></li></ul></li><li><a href="templates.html">templates</a><ul class='methods'><li data-type='method'><a href="templates.html#.list">list</a></li></ul></li><li><a href="users.html">users</a><ul class='methods'><li data-type='method'><a href="users.html#.list">list</a></li></ul></li></ul>
26+
</nav>
27+
28+
<div id="main">
29+
30+
<h1 class="page-title">jobs/machineTypes.js</h1>
31+
32+
33+
34+
35+
36+
37+
38+
<section>
39+
<article>
40+
<pre class="prettyprint source linenums"><code>'use strict';
41+
42+
var method = require('./../method');
43+
var assign = require('lodash.assign');
44+
45+
/**
46+
* @memberof jobs
47+
* @method machineTypes
48+
* @description Return a list of available cluster machine types. If the isBusy property is true then all machines of the specified type and cluster are currently running jobs.
49+
* The machineTypes method takes an optional first argument to limit the returned cluster machine type objects.
50+
* @param {object} [filter] - An optional filter object to limit the returned job objects
51+
* @param {string} [filter.clusterName] - Optional cluster name to match on
52+
* @param {string} [filter.machineType] - Optional machine type to macth on
53+
* @param {boolean} [filter.isBusy] - Optional busy status value to match on
54+
* @param {function} cb - Node-style error-first callback function
55+
* @returns {array} [ clusterMachineType, ... ] - JSON array of available cluster machine type objects
56+
* @example
57+
* paperspace.jobs.machineTypes({
58+
* // clusterName: 'PS Jobs', // optional filter on cluster name
59+
* // machineType: 'P5000', // optional filter on machine type
60+
* // isBusy: false, // optional filter on busy status
61+
* } function(err, res) {
62+
* // handle error or result
63+
* });
64+
* @example
65+
* $ paperspace jobs machineTypes
66+
* @example
67+
* # HTTP request:
68+
* https://api.paperspace.io
69+
* GET /jobs/getClusterAvailableMachineTypes
70+
* x-api-key: 1ba4f98e7c0...
71+
* # Returns 200 on success
72+
* @example
73+
* //Example return value:
74+
* [
75+
* {
76+
* "clusterType": "Jobs Cluster",
77+
* "clusterName": "PS Jobs",
78+
* "machineType": "P5000",
79+
* "isBusy": false,
80+
* },
81+
* {
82+
* "clusterType": "Jobs Cluster",
83+
* "clusterName": "PS Jobs",
84+
* "machineType": "V100",
85+
* "isBusy": false,
86+
* },
87+
* {
88+
* "clusterType": "Jobs Cluster",
89+
* "clusterName": "PS Jobs on GCP",
90+
* "machineType": "K80",
91+
* "isBusy": false,
92+
* },
93+
* {
94+
* "clusterType": "Jobs Cluster",
95+
* "clusterName": "PS Jobs on GCP",
96+
* "machineType": "P100",
97+
* "isBusy": false,
98+
* }
99+
* ]
100+
*/
101+
102+
function machineTypes(params, cb) {
103+
return method(machineTypes, params, cb);
104+
}
105+
106+
assign(machineTypes, {
107+
auth: true,
108+
group: 'jobs',
109+
name: 'machineTypes',
110+
method: 'get',
111+
route: '/jobs/getClusterAvailableMachineTypes',
112+
requires: {},
113+
returns: {},
114+
});
115+
116+
module.exports = machineTypes;
117+
</code></pre>
118+
</article>
119+
</section>
120+
121+
122+
123+
124+
</div>
125+
126+
<br class="clear">
127+
128+
<footer>
129+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Mar 12 2018 14:11:38 GMT-0400 (EDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
130+
</footer>
131+
132+
<script>prettyPrint();</script>
133+
<script src="scripts/linenumber.js"></script>
134+
</body>
135+
</html>

lib/jobs/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ module.exports = {
1313
destroy: require('./destroy'),
1414
list: require('./list'),
1515
logs: require('./logs'),
16+
machineTypes: require('./machineTypes'),
1617
show: require('./show'),
1718
stop: require('./stop'),
1819
waitfor: require('./waitfor'),

lib/jobs/machineTypes.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
'use strict';
2+
3+
var method = require('./../method');
4+
var assign = require('lodash.assign');
5+
6+
/**
7+
* @memberof jobs
8+
* @method machineTypes
9+
* @description Return a list of available cluster machine types. If the isBusy property is true then all machines of the specified type and cluster are currently running jobs.
10+
* The machineTypes method takes an optional first argument to limit the returned cluster machine type objects.
11+
* @param {object} [filter] - An optional filter object to limit the returned job objects
12+
* @param {string} [filter.clusterName] - Optional cluster name to match on
13+
* @param {string} [filter.machineType] - Optional machine type to macth on
14+
* @param {boolean} [filter.isBusy] - Optional busy status value to match on
15+
* @param {function} cb - Node-style error-first callback function
16+
* @returns {array} [ clusterMachineType, ... ] - JSON array of available cluster machine type objects
17+
* @example
18+
* paperspace.jobs.machineTypes({
19+
* // clusterName: 'PS Jobs', // optional filter on cluster name
20+
* // machineType: 'P5000', // optional filter on machine type
21+
* // isBusy: false, // optional filter on busy status
22+
* }, function(err, res) {
23+
* // handle error or result
24+
* });
25+
* @example
26+
* $ paperspace jobs machineTypes
27+
* @example
28+
* # HTTP request:
29+
* https://api.paperspace.io
30+
* GET /jobs/getClusterAvailableMachineTypes
31+
* x-api-key: 1ba4f98e7c0...
32+
* # Returns 200 on success
33+
* @example
34+
* //Example return value:
35+
* [
36+
* {
37+
* "clusterType": "Jobs Cluster",
38+
* "clusterName": "PS Jobs",
39+
* "machineType": "P5000",
40+
* "isBusy": false,
41+
* },
42+
* {
43+
* "clusterType": "Jobs Cluster",
44+
* "clusterName": "PS Jobs",
45+
* "machineType": "V100",
46+
* "isBusy": false,
47+
* },
48+
* {
49+
* "clusterType": "Jobs Cluster",
50+
* "clusterName": "PS Jobs on GCP",
51+
* "machineType": "K80",
52+
* "isBusy": false,
53+
* },
54+
* {
55+
* "clusterType": "Jobs Cluster",
56+
* "clusterName": "PS Jobs on GCP",
57+
* "machineType": "P100",
58+
* "isBusy": false,
59+
* }
60+
* ]
61+
*/
62+
63+
function machineTypes(params, cb) {
64+
return method(machineTypes, params, cb);
65+
}
66+
67+
assign(machineTypes, {
68+
auth: true,
69+
group: 'jobs',
70+
name: 'machineTypes',
71+
method: 'get',
72+
route: '/jobs/getClusterAvailableMachineTypes',
73+
requires: {},
74+
returns: {},
75+
});
76+
77+
module.exports = machineTypes;

0 commit comments

Comments
 (0)