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

Commit 848a125

Browse files
committed
enhance result examples for job methods
1 parent 3c0a939 commit 848a125

File tree

8 files changed

+132
-15
lines changed

8 files changed

+132
-15
lines changed

lib/jobs/artifactsGet.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,24 @@ var mkdirp = require('mkdirp');
2323
* @returns one or more artifact files
2424
* @example
2525
* paperspace.jobs.artifactsGet({
26-
* jobId: 'j123abc',
27-
* files: 'myfiles*' // optional
26+
* jobId: 'j123abc'
2827
* }, function(err, res) {
2928
* // handle error or result
3029
* });
3130
* @example
3231
* $ paperspace jobs artifactsGet \
33-
* --jobId "j123abc" \
34-
* --files "myfiles*"
32+
* --jobId "j123abc"
3533
* @example
3634
* # HTTP request:
3735
* https://api.paperspace.io
3836
* GET /jobs/artifactsGet?jobId=j123abc&files=myfiles*
3937
* x-api-key: 1ba4f98e7c0...
4038
* # Returns 200 on success
39+
* @example
40+
* //Example output:
41+
* Downloading myoutput1.txt
42+
* Downloading myoutput2.txt
43+
* Downloads finished
4144
*/
4245

4346
function expandHomeDir(pathIn) {

lib/jobs/artifactsList.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,31 @@ var assign = require('lodash.assign');
1717
* @example
1818
* paperspace.jobs.artifactsList({
1919
* jobId: 'j123abc',
20+
* size: true
2021
* }, function(err, res) {
2122
* // handle error or result
2223
* });
2324
* @example
2425
* $ paperspace jobs artifactsList \
25-
* --jobId "j123abc"
26+
* --jobId "j123abc" \
27+
* --size true
2628
* @example
2729
* # HTTP request:
2830
* https://api.paperspace.io
2931
* GET /jobs/artifactsList?jobId=j123abc
3032
* x-api-key: 1ba4f98e7c0...
3133
* # Returns 200 on success
34+
* //Example return value:
35+
* [
36+
* {
37+
* "file": "myoutput1.txt"
38+
* "size": 443141
39+
* },
40+
* {
41+
* "file": "myoutput2.txt"
42+
* "size": 1456
43+
* }
44+
* ]
3245
*/
3346

3447
function artifactsList(params, cb) {

lib/jobs/clone.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,31 @@ var assign = require('lodash.assign');
2929
* //Example return value:
3030
* {
3131
* "id": "j345abc",
32-
* "name": "My Job",
33-
* "state": "running",
32+
* "name": "job for project myproject",
33+
* "state": "Pending",
34+
* "workspaceUrl": "myproject.zip",
35+
* "workingDirectory": "/paperspace",
36+
* "artifactsDirectory": "/artifacts",
37+
* "entrypoint": "echo Hello Paperspace",
38+
* "projectId": "pr456def",
39+
* "project": "myproject",
40+
* "container": "http://dockerhub.com/mycontainer",
41+
* "machineType": "P5000",
42+
* "cluster": "Jobs",
43+
* "usageRate": "P5000 hourly",
44+
* "startedByUserId": "u789ghi",
45+
* "parentJobId": "j123abc",
46+
* "jobError": null,
47+
* "dtCreated": "2017-11-30T19:20:38.956Z",
48+
* "dtModified": "2017-11-30T19:20:39.744Z",
49+
* "dtProvisioningStarted": null,
50+
* "dtProvisioningFinished": null,
51+
* "dtStarted": null,
52+
* "dtFinished": null,
53+
* "dtTeardownStarted": null,
54+
* "dtTeardownFinished": null,
55+
* "dtDeleted": null,
56+
* "exitCode": null
3457
* }
3558
*/
3659

lib/jobs/create.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ var jobs_show = require('./../jobs/show.js');
4141
* @example
4242
* $ paperspace jobs create \
4343
* --container "http://dockerhub.com/mycontainer" \
44-
* --machineType "P6000"
44+
* --machineType "P5000"
4545
* @example
4646
* # HTTP request:
4747
* https://api.paperspace.io
48-
* POST /jobs/createJob { "container": "http://dockerhub.com/mycontainer", "machineType": "P6000" }
48+
* POST /jobs/createJob { "container": "http://dockerhub.com/mycontainer", "machineType": "P5000" }
4949
* x-api-key: 1ba4f98e7c0...
5050
* # Returns 201 on success
5151
* @example
@@ -61,9 +61,9 @@ var jobs_show = require('./../jobs/show.js');
6161
* "projectId": "pr456def",
6262
* "project": "myproject",
6363
* "container": "http://dockerhub.com/mycontainer",
64-
* "machineType": "P6000",
64+
* "machineType": "P5000",
6565
* "cluster": "Jobs",
66-
* "usageRate": "P6000 hourly",
66+
* "usageRate": "P5000 hourly",
6767
* "startedByUserId": "u789ghi",
6868
* "parentJobId": null,
6969
* "jobError": null,

lib/jobs/list.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,32 @@ var path = require('path');
4444
* "id": "j123abc",
4545
* "name": "My Job",
4646
* "state": "running"
47+
* "id": "j123abc",
48+
* "name": "job for project myproject",
49+
* "state": "Stopped",
50+
* "workspaceUrl": "myproject.zip",
51+
* "workingDirectory": "/paperspace",
52+
* "artifactsDirectory": "/artifacts",
53+
* "entrypoint": "echo Hello Paperspace",
54+
* "projectId": "pr456def",
55+
* "project": "myproject",
56+
* "container": "http://dockerhub.com/mycontainer",
57+
* "machineType": "P5000",
58+
* "cluster": "Jobs",
59+
* "usageRate": "P5000 hourly",
60+
* "startedByUserId": "u789ghi",
61+
* "parentJobId": null,
62+
* "jobError": null,
63+
* "dtCreated": "2017-11-30T18:46:10.394Z",
64+
* "dtModified": "2017-11-30T18:46:10.394Z",
65+
* "dtProvisioningStarted": "2017-11-30T18:46:50.467Z",
66+
* "dtProvisioningFinished": "2017-11-30T18:47:12.508Z",
67+
* "dtStarted": "2017-11-30T18:47:14.636Z",
68+
* "dtFinished": "2017-11-30T18:52:44.209Z",
69+
* "dtTeardownStarted": "2017-11-30T18:52:56.889Z",
70+
* "dtTeardownFinished": "2017-11-30T18:53:31.734Z",
71+
* "dtDeleted": null,
72+
* "exitCode": 0
4773
* }
4874
* ]
4975
*/

lib/jobs/logs.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ var assign = require('lodash.assign');
3131
* GET /jobs/getLogs?jobId=j123abc
3232
* x-api-key: 1ba4f98e7c0...
3333
* # Returns 200 on success
34+
* @example
35+
* //Example output:
36+
* Hello Paperspace
37+
* Creating file /artifacts/myoutput1.txt
38+
* Creating file /artifacts/myoutput2.txt
39+
* Finished; returning exit code 0
3440
*/
3541

3642
function parseLogs(data, allLogs, json) {

lib/jobs/show.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,31 @@ var assign = require('lodash.assign');
3131
* //Example return value:
3232
* {
3333
* "id": "j123abc",
34-
* "name": "My Job",
35-
* "state": "running",
34+
* "name": "job for project myproject",
35+
* "state": "Running",
36+
* "workspaceUrl": "myproject.zip",
37+
* "workingDirectory": "/paperspace",
38+
* "artifactsDirectory": "/artifacts",
39+
* "entrypoint": "echo Hello Paperspace",
40+
* "projectId": "pr456def",
41+
* "project": "myproject",
42+
* "container": "http://dockerhub.com/mycontainer",
43+
* "machineType": "P5000",
44+
* "cluster": "Jobs",
45+
* "usageRate": "P5000 hourly",
46+
* "startedByUserId": "u789ghi",
47+
* "parentJobId": null,
48+
* "jobError": null,
49+
* "dtCreated": "2017-11-30T18:46:10.394Z",
50+
* "dtModified": "2017-11-30T18:46:10.394Z",
51+
* "dtProvisioningStarted": "2017-11-30T18:46:50.467Z",
52+
* "dtProvisioningFinished": "2017-11-30T18:47:12.508Z",
53+
* "dtStarted": "2017-11-30T18:47:14.636Z",
54+
* "dtFinished": null,
55+
* "dtTeardownStarted": null,
56+
* "dtTeardownFinished": null,
57+
* "dtDeleted": null,
58+
* "exitCode": null
3659
* }
3760
*/
3861

lib/jobs/waitfor.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,31 @@ var assign = require('lodash.assign');
4141
* //Example return value:
4242
* {
4343
* "id": "j123abc",
44-
* "name": "My Job",
45-
* "state": "Stopped"
44+
* "name": "job for project myproject",
45+
* "state": "Stopped",
46+
* "workspaceUrl": "myproject.zip",
47+
* "workingDirectory": "/paperspace",
48+
* "artifactsDirectory": "/artifacts",
49+
* "entrypoint": "echo Hello Paperspace",
50+
* "projectId": "pr456def",
51+
* "project": "myproject",
52+
* "container": "http://dockerhub.com/mycontainer",
53+
* "machineType": "P5000",
54+
* "cluster": "Jobs",
55+
* "usageRate": "P5000 hourly",
56+
* "startedByUserId": "u789ghi",
57+
* "parentJobId": null,
58+
* "jobError": null,
59+
* "dtCreated": "2017-11-30T18:46:10.394Z",
60+
* "dtModified": "2017-11-30T18:46:10.394Z",
61+
* "dtProvisioningStarted": "2017-11-30T18:46:50.467Z",
62+
* "dtProvisioningFinished": "2017-11-30T18:47:12.508Z",
63+
* "dtStarted": "2017-11-30T18:47:14.636Z",
64+
* "dtFinished": "2017-11-30T18:52:44.209Z",
65+
* "dtTeardownStarted": "2017-11-30T18:52:56.889Z",
66+
* "dtTeardownFinished": "2017-11-30T18:53:31.734Z",
67+
* "dtDeleted": null,
68+
* "exitCode": 0
4669
* }
4770
*/
4871

0 commit comments

Comments
 (0)