- Source:
Methods
(static) artifactsDestroy(params, cb)
- Source:
Destroy artifact files of the job with the given id. The name of a particular file, or directory can be specified, and can include a wildcard character at the end, e.g., "myfiles*". If no specifc file or directory is specified all artifact files will be destroyed.
Examples
paperspace.jobs.artifactsDestroy({
jobId: 'j123abc',
files: 'myfiles*' // optional
}, function(err, res) {
// handle error or result
});
$ paperspace jobs artifactsDestroy \
--jobId "j123abc" \
--files "myfiles*"
# HTTP request:
https://api.paperspace.io
POST /jobs/j123abc/artifactsDestroy?files=myfiles*
x-api-key: 1ba4f98e7c0...
# Returns 204 on success
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | Artifacts destroy parameters Properties
|
||||||||||||
cb |
function | Node-style error-first callback function |
(static) artifactsGet(params, cb)
- Source:
Get the artifacts files for the job with the given id. The name of a particular file, or directory can be specified, and can include a wildcard character at the end, e.g., "myfiles"*. If no specifc file or directory is specified all artifact files will be retrieved.
Examples
paperspace.jobs.artifactsGet({
jobId: 'j123abc'
}, function(err, res) {
// handle error or result
});
$ paperspace jobs artifactsGet \
--jobId "j123abc"
# HTTP request:
https://api.paperspace.io
GET /jobs/artifactsGet?jobId=j123abc&files=myfiles*
x-api-key: 1ba4f98e7c0...
# Returns 200 on success
//Example output:
Downloading myoutput1.txt
Downloading myoutput2.txt
Downloads finished
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | Artifacts get parameters Properties
|
||||||||||||||||||||
cb |
function | Node-style error-first callback function |
Returns:
one or more artifact files
(static) artifactsList()
- Source:
List job artifact files for the specified job.
Examples
paperspace.jobs.artifactsList({
jobId: 'j123abc',
size: true
}, function(err, res) {
// handle error or result
});
$ paperspace jobs artifactsList \
--jobId "j123abc" \
--size true
# HTTP request:
https://api.paperspace.io
GET /jobs/artifactsList?jobId=j123abc
x-api-key: 1ba4f98e7c0...
# Returns 200 on success
//Example return value:
[
{
"file": "myoutput1.txt"
"size": 443141
},
{
"file": "myoutput2.txt"
"size": 1456
}
]
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params.jobId |
string | Id of the job to list artifacts for |
|
params.files |
string |
<optional> |
Optional; wildcard expression of file(s) to list, e.g., "myfiles*". Note: if you include a wildcard you must double-quote the files argument. |
params.size |
boolean |
<optional> |
Optional; include file size in bytes. '--size' with no value is equivalent to true. |
params.links |
boolean |
<optional> |
Optional; include https links to artifacts. Note: links are only valid for 8 hours. '--links' with no value is equivalent to true. |
params.json |
boolean |
<optional> |
Optional; return JSON object instead of writing to standard out. '--json' with no value is equivalent to true. |
Returns:
artifact files list
(static) clone(params, cb)
- Source:
Clone an exiting job and queue the cloned copy to run.
Examples
paperspace.jobs.clone({
jobId: 'j123abc',
}, function(err, res) {
// handle error or result
});
$ paperspace jobs clone --jobId "j123abc"
# HTTP request:
https://api.paperspace.io
POST /jobs/j123abc/clone
x-api-key: 1ba4f98e7c0...
# Returns 200 on success
//Example return value:
{
"id": "j345abc",
"name": "job for project myproject",
"state": "Pending",
"workspaceUrl": "myproject.zip",
"workingDirectory": "/paperspace",
"artifactsDirectory": "/artifacts",
"entrypoint": "echo Hello Paperspace",
"projectId": "pr456def",
"project": "myproject",
"container": "http://dockerhub.com/mycontainer",
"machineType": "P5000",
"cluster": "PS Jobs",
"usageRate": "P5000 hourly",
"startedByUserId": "u789ghi",
"parentJobId": "j123abc",
"jobError": null,
"dtCreated": "2017-11-30T19:20:38.956Z",
"dtModified": "2017-11-30T19:20:39.744Z",
"dtProvisioningStarted": null,
"dtProvisioningFinished": null,
"dtStarted": null,
"dtFinished": null,
"dtTeardownStarted": null,
"dtTeardownFinished": null,
"dtDeleted": null,
"exitCode": null
}
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params |
object | Job clone parameters Properties
|
||||||
cb |
function | Node-style error-first callback function |
(static) create(params, cb) → {object}
- Source:
Create a new Paperspace job, and tail its log output if run at the command line. To disable the tailing behavior specify '--tail false'. Note: if a project is not defined for the current working directory, and you are running in command line mode, a project configuration settings file will be created. Use '--init false' or specify '--project [projectname]' to override this behavior.
Examples
paperspace.jobs.create({
container: 'http://dockerhub.com/mycontainer',
machineType: 'P5000',
}, function(err, res) {
// handle error or result
});
$ paperspace jobs create \
--container "http://dockerhub.com/mycontainer" \
--machineType "P5000"
# HTTP request:
https://api.paperspace.io
POST /jobs/createJob { "container": "http://dockerhub.com/mycontainer", "machineType": "P5000" }
x-api-key: 1ba4f98e7c0...
# Returns 201 on success
// Example return value:
{
"id": "j123abc",
"name": "job for project myproject",
"state": "Pending",
"workspaceUrl": "myproject.zip",
"workingDirectory": "/paperspace",
"artifactsDirectory": "/artifacts",
"entrypoint": "echo Hello Paperspace",
"projectId": "pr456def",
"project": "myproject",
"container": "http://dockerhub.com/mycontainer",
"machineType": "P5000",
"cluster": "PS Jobs",
"usageRate": "P5000 hourly",
"startedByUserId": "u789ghi",
"parentJobId": null,
"jobError": null,
"dtCreated": "2017-11-30T18:46:10.394Z",
"dtModified": "2017-11-30T18:46:10.394Z",
"dtProvisioningStarted": null,
"dtProvisioningFinished": null,
"dtStarted": null,
"dtFinished": null,
"dtTeardownStarted": null,
"dtTeardownFinished": null,
"dtDeleted": null,
"exitCode": null
"storageRegion": "East Coast (NY2)",
"clusterMachine": "psABCD123",
"ipAddress": "10.100.0.10",
"ports": "6006:6006",
}
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | Job creation parameters Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cb |
function | Node-style error-first callback function |
Returns:
job - The created job JSON object
- Type
- object
(static) destroy(params, cb)
- Source:
Destroy the job with the given id. When this action is performed, the job is immediately stopped and marked for deletion. Access to the job is terminated immediately and billing for the job is prorated to the minute.
Examples
paperspace.jobs.destroy({
jobId: 'j123abc',
}, function(err, res) {
// handle error or result
});
$ paperspace jobs destroy --jobId "j123abc"
# HTTP request:
https://api.paperspace.io
POST /jobs/j123abc/destroy
x-api-key: 1ba4f98e7c0...
# Returns 204 on success
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params |
object | Job destroy parameters Properties
|
||||||
cb |
function | Node-style error-first callback function |
(static) list(filteropt, summaryopt, cb) → {array}
- Source:
List information about all jobs available to either the current authenticated user or the team, if the user belongs to a team. The list method takes an optional first argument to limit the returned job objects.
Examples
paperspace.jobs.list(
project: 'MyProject'
}, function(err, res) {
// handle error or result
});
$ paperspace jobs list --project "MyProject" --state Running --summary
# HTTP request:
https://api.paperspace.io
GET /jobs/getJobs?project=MyProject
x-api-key: 1ba4f98e7c0...
# Returns 200 on success
//Example return value:
[
{
"id": "j123abc",
"name": "My Job",
"state": "running"
"id": "j123abc",
"name": "job for project myproject",
"state": "Stopped",
"workspaceUrl": "myproject.zip",
"workingDirectory": "/paperspace",
"artifactsDirectory": "/artifacts",
"entrypoint": "echo Hello Paperspace",
"projectId": "pr456def",
"project": "myproject",
"container": "http://dockerhub.com/mycontainer",
"machineType": "P5000",
"cluster": "PS Jobs",
"usageRate": "P5000 hourly",
"startedByUserId": "u789ghi",
"parentJobId": null,
"jobError": null,
"dtCreated": "2017-11-30T18:46:10.394Z",
"dtModified": "2017-11-30T18:46:10.394Z",
"dtProvisioningStarted": "2017-11-30T18:46:50.467Z",
"dtProvisioningFinished": "2017-11-30T18:47:12.508Z",
"dtStarted": "2017-11-30T18:47:14.636Z",
"dtFinished": "2017-11-30T18:52:44.209Z",
"dtTeardownStarted": "2017-11-30T18:52:56.889Z",
"dtTeardownFinished": "2017-11-30T18:53:31.734Z",
"dtDeleted": null,
"exitCode": 0
}
]
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
filter |
object |
<optional> |
An optional filter object to limit the returned job objects Properties
|
||||||||||||||||||||||||||||||||||||||||||||
summary |
boolean |
<optional> |
Optional (command line argument only). Format output as a summary table. |
||||||||||||||||||||||||||||||||||||||||||||
cb |
function | Node-style error-first callback function |
Returns:
[ job, ... ] - JSON array of job objects
- Type
- array
(static) logs(params, cb)
- Source:
Stream the logs for the job with the given id, while the job is running or after it has stopped.
Examples
paperspace.jobs.logs({
jobId: 'j123abc',
}, function(err, res) {
// handle error or result
});
$ paperspace jobs logs \
--jobId "j123abc"
# HTTP request:
https://logs.paperspace.io
GET /jobs/logs?jobId=j123abc
x-api-key: 1ba4f98e7c0...
# Returns 200 on success
//Example output:
Hello Paperspace
Creating file /artifacts/myoutput1.txt
Creating file /artifacts/myoutput2.txt
Finished; returning exit code 0
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | Job logs parameters Properties
|
||||||||||||||||||||||||
cb |
function | Node-style error-first callback function |
Returns:
logs - The job logs
(static) machineTypes(filteropt, cb) → {array}
- Source:
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. The machineTypes method takes an optional first argument to limit the returned cluster machine type objects.
Examples
paperspace.jobs.machineTypes({
// region: 'East Coast (NY2)', // optional filter on region
// cluster: 'PS Jobs', // optional filter on cluster
// machineType: 'P5000', // optional filter on machine type
// isBusy: false, // optional filter on busy status
}, function(err, res) {
// handle error or result
});
$ paperspace jobs machineTypes
# HTTP request:
https://api.paperspace.io
GET /jobs/getClusterAvailableMachineTypes
x-api-key: 1ba4f98e7c0...
# Returns 200 on success
//Example return value:
[
{
"region": "East Coast (NY2)",
"cluster": "PS Jobs",
"machineType": "P5000",
"isBusy": false,
},
{
"region": "East Coast (NY2)",
"cluster": "PS Jobs",
"machineType": "V100",
"isBusy": false,
},
{
"region": "GCP West",
"cluster": "PS Jobs on GCP",
"machineType": "K80",
"isBusy": false,
},
{
"region": "GCP West",
"cluster": "PS Jobs on GCP",
"machineType": "P100",
"isBusy": false,
}
]
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
filter |
object |
<optional> |
An optional filter object to limit the returned job objects Properties
|
||||||||||||||||||||
cb |
function | Node-style error-first callback function |
Returns:
[ clusterMachineType, ... ] - JSON array of available cluster machine type objects
- Type
- array
(static) show(params, cb) → {object}
- Source:
Show job information for the job with the given id.
Examples
paperspace.jobs.show({
jobId: 'j123abc',
}, function(err, res) {
// handle error or result
});
$ paperspace jobs show \
--jobId "j123abc"
# HTTP request:
https://api.paperspace.io
GET /jobs/getJob?jobId=j123abc
x-api-key: 1ba4f98e7c0...
# Returns 200 on success
//Example return value:
{
"id": "j123abc",
"name": "job for project myproject",
"state": "Running",
"workspaceUrl": "myproject.zip",
"workingDirectory": "/paperspace",
"artifactsDirectory": "/artifacts",
"entrypoint": "echo Hello Paperspace",
"projectId": "pr456def",
"project": "myproject",
"container": "http://dockerhub.com/mycontainer",
"machineType": "P5000",
"cluster": "PS Jobs",
"usageRate": "P5000 hourly",
"startedByUserId": "u789ghi",
"parentJobId": null,
"jobError": null,
"dtCreated": "2017-11-30T18:46:10.394Z",
"dtModified": "2017-11-30T18:46:10.394Z",
"dtProvisioningStarted": "2017-11-30T18:46:50.467Z",
"dtProvisioningFinished": "2017-11-30T18:47:12.508Z",
"dtStarted": "2017-11-30T18:47:14.636Z",
"dtFinished": null,
"dtTeardownStarted": null,
"dtTeardownFinished": null,
"dtDeleted": null,
"exitCode": null
}
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params |
object | Job show parameters Properties
|
||||||
cb |
function | Node-style error-first callback function |
Returns:
job - The job JSON object
- Type
- object
(static) stop(params, cb)
- Source:
Stop an individual job. If the job is already stopped, this action is a no-op. If the job is running, it will be stopped.
Examples
paperspace.jobs.stop({
jobId: 'j123abc',
}, function(err, res) {
// handle error or result
});
$ paperspace jobs stop --jobId "j123abc"
# HTTP request:
https://api.paperspace.io
POST /jobs/j123abc/stop
x-api-key: 1ba4f98e7c0...
# Returns 204 on success
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
params |
object | Job stop parameters Properties
|
||||||
cb |
function | Node-style error-first callback function |
(static) waitfor(params, cb) → {object}
- Source:
Wait for the job with the given id to enter a certain job state. This action polls the server and returns only when we detect that the job has transitioned into the given state, or to the 'Error' state. States available to query for are:
- Pending - the job has not started setting up on a machine yet
- Running - the job is setting up on a machine, running, or tearing down
- Stopped - the job finished with a job command exit code of 0
- Error - the job was unable to setup or run to normal completion
- Failed - the job finished but the job command exit code was non-zero
- Cancelled - the job was manual stopped before completion
When the callback is called, the returned object will be information about the job.
Examples
paperspace.job.waitfor({
jobId: 'j123abc',
state: 'Stopped',
}, function(err, res) {
// handle error or result
});
$ paperspace jobs waitfor \
--jobId "j123abc" \
--state "Stopped"
# HTTP request:
# The waitefor method is only available using the API client.
# Use the jobs show method to query the state of the job via HTTP.
//Example return value:
{
"id": "j123abc",
"name": "job for project myproject",
"state": "Stopped",
"workspaceUrl": "myproject.zip",
"workingDirectory": "/paperspace",
"artifactsDirectory": "/artifacts",
"entrypoint": "echo Hello Paperspace",
"projectId": "pr456def",
"project": "myproject",
"container": "http://dockerhub.com/mycontainer",
"machineType": "P5000",
"cluster": "PS Jobs",
"usageRate": "P5000 hourly",
"startedByUserId": "u789ghi",
"parentJobId": null,
"jobError": null,
"dtCreated": "2017-11-30T18:46:10.394Z",
"dtModified": "2017-11-30T18:46:10.394Z",
"dtProvisioningStarted": "2017-11-30T18:46:50.467Z",
"dtProvisioningFinished": "2017-11-30T18:47:12.508Z",
"dtStarted": "2017-11-30T18:47:14.636Z",
"dtFinished": "2017-11-30T18:52:44.209Z",
"dtTeardownStarted": "2017-11-30T18:52:56.889Z",
"dtTeardownFinished": "2017-11-30T18:53:31.734Z",
"dtDeleted": null,
"exitCode": 0
}
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | Job waitfor parameters Properties
|
|||||||||
cb |
function | Node-style error-first callback function |
Returns:
job - The job JSON object
- Type
- object