@@ -35,28 +35,36 @@ Sample usage
3535
3636 ` python hello.py `
3737
38- This sample shows how a script can automatically run itself on the Paperspace job cluster node.
39- Note: the script is further modified before transfer in order to remove ` paperspace ` references.
38+ The source of this sample script shows how a script can automatically run itself on the Paperspace job cluster node:
39+
40+ ```
41+ import paperspace
42+
43+ paperspace.run()
44+
45+ print('hello paperspace-python!')
46+ ```
47+
48+ Note: the source is modified before transfer to the job cluster in order to remove imported `paperspace` references.
4049
41506. Execute an unmodified Python script remotely:
4251
43- ` paperspace-python myscript.py `
52+ `paperspace-python run myscript.py`
4453
45- The script will be run on the Paperspace job cluster node, and its output will be logged locally.
54+ The script will be run on the Paperspace job cluster node, and its output will be logged locally.
4655
4756
4857A slightly more complex example
4958===============================
50- # tests/test_remote.py
5159
60+ # tests/test_remote.py - runs itself on paperspace, demonstrates setting jobs create options
5261 import os
53-
5462 import paperspace
5563
56- paperspace.run({'project': 'myproject', 'machineType': 'GPU+', 'container': 'Test-Container'})
64+ paperspace.run({'project': 'myproject', 'machineType': 'P5000',
65+ 'container': 'paperspace/tensorflow-python'})
5766
5867 print(os.getcwd())
59-
6068 print('something useful')
6169
6270
@@ -82,7 +90,8 @@ You can run an python script on paperspace from the command line as follows:
8290
8391You can also provide additional jobs options on the command line:
8492
85- paperspace-python run myscript.py --project myproject --machineType P5000 --container Test-Container
93+ paperspace-python run myscript.py --project myproject --machineType P5000 \
94+ --container paperspace/tensorflow-python`
8695
8796Alternatively you can use the `paperspace.run()` fuction in code with, a script file name as the first argument:
8897
@@ -92,7 +101,8 @@ Alternatively you can use the `paperspace.run()` fuction in code with, a script
92101
93102In code you can provide additional paperspace jobs create options in a dict in the second argument to run():
94103
95- paperspace.run('myscript.py', {'project': 'myproject', 'machineType': 'GPU+', 'container': 'Test-Container'})
104+ paperspace.run('myscript.py', {'project': 'myproject', 'machineType': 'P5000',
105+ 'container': 'paperspace/tensorflow-python'})
96106
97107See the Paperspace API [jobs create](https://paperspace.github.io/paperspace-node/jobs.html#.create) documentation for the full list of jobs create options that can be specified.
98108
@@ -102,7 +112,16 @@ Setting up python script dependencies remotely
102112When running python scripts on paperspace you may need to provide additional dependencies to your scripts.
103113The `paperspace-python run` command and `paperspace.run()` function provide several options to support this:
104114
105- paperspace-python run [-m] <python_script.py> [--python 2|3] [--init [<init.sh>]] [--pipenv] [--req [<requirements.txt>] [--workspace .|<workspace_path>] [--ignoreFiles "<file-or-dir>,<file-or-dir>,..."] [other jobs create options...] [--dryrun] [script args]
115+ paperspace-python run [-m] <python_script.py>
116+ [--python 2|3]
117+ [--init [<init.sh>]]
118+ [--pipenv]
119+ [--req [<requirements.txt>]]
120+ [--workspace .|<workspace_path>]
121+ [--ignoreFiles "<file-or-dir>,<file-or-dir>,..."]
122+ [other jobs create options...]
123+ [--dryrun]
124+ [script args]
106125
107126The `-m` option runs the specified library module as a script. This is equivalent to the `-m` option of the `python` executable.
108127
@@ -158,9 +177,12 @@ See the scripts in the `tests` folder for other examples.
158177
159178Other Authentication options
160179============================
161- 1 . Specify your apiKey explicitly on any of the paperspace.jobs methods, e.g.:
180+ 1. Specify your apiKey explicitly on the paperspace.run() function or any of the paperspace.jobs methods, e.g.:
162181
163- ` paperspace.jobs.create({'apiKey': '1qks1hKsU7e1k...', 'project': 'myproject', 'machineType': 'GPU+', 'container': 'Test-Container'}) `
182+ ```
183+ paperspace.jobs.create({'apiKey': '1qks1hKsU7e1k...', 'project': 'myproject',
184+ 'machineType': 'P5000', 'container': 'paperspace/tensorflow-python'})
185+ ```
164186
1651872. Set the package paperspace.config option in your python code:
166188
0 commit comments