-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04-remote-config.py
47 lines (35 loc) · 1.47 KB
/
04-remote-config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Customizing your remote configuration.
rx gives you a lot of flexibility in terms of RAM, disk, CPU, and GPU options
on your remote machine.
You can check out your current configuration by looking at .rx/remotes/default.
When you run `rx init`, rx uses that to provision a bog-standard Python 3.11
instance.
However, the files in .rx/remotes are simply starter templates and you can
create any configuration you want.
For example, this file uses removeprefix, which is a method added in Python
3.9. Try running this with Python 3.7 by creating a file
`my-rx-configs/py37.yaml` with the following content:
image:
repository: "python:3.7-slim"
Now tell rx that you want to use a different remote machine configuration by
running `rx init` again, this time with the --remote flag:
$ rx init --remote=my-rx-configs/py37.yaml
Now if you run this script, you should see:
$ rx python 04-remote-config.py
Some Python projects:
Traceback (most recent call last):
File "04-remote-config.py", line 44, in <module>
print(proj.removesuffix('Py'))
AttributeError: 'str' object has no attribute 'removesuffix'
To upgrade back to Python 3.11, run `rx init` again without any flags and it'll
go back to using the config `default` is symlinked to. Now it prints:
$ rx python 04-remote-config.py
Some Python projects:
Torch
Pi
Mongo
"""
PY_PROJECTS = ['PyTorch', 'PyPi', 'PyMongo']
print('Some Python projects:')
for proj in PY_PROJECTS:
print(proj.removeprefix('Py'))