|
1 | | -# this is an absolute overkill for just adding two numbers but we will |
2 | | -# still do it |
| 1 | +# # this is an absolute overkill for just adding two numbers but we will |
| 2 | +# # still do it |
| 3 | + |
| 4 | +import time |
| 5 | + |
| 6 | +from pprint import pprint as peepee |
3 | 7 |
|
4 | 8 | from nbox import Instance |
5 | 9 | from nbox.utils import nbox_session |
6 | 10 |
|
7 | 11 | instance = Instance("GPT4NBX", url = "https://test-2.nimblebox.ai") |
8 | | -print(instance) |
9 | | -# instance.test() |
10 | | -# instance.start(True, wait = True) |
11 | | -# instance.get_files() |
12 | | -instance.run_script("add.py") |
13 | | -instance.get_script_status("add.py") |
14 | | - |
15 | | -# instance.stop(wait = True) |
| 12 | +# instance = Instance.create("GPT4NBX", url = "https://test-2.nimblebox.ai") |
| 13 | +instance.start(True) |
| 14 | +# instance("add.py") |
| 15 | +# instance.stop() |
| 16 | + |
| 17 | +instance.compute_server.test("get").json() |
| 18 | +instance.compute_server.get_files( |
| 19 | + "post", {"dir_path": "/"}, verbose = True |
| 20 | +).json() |
| 21 | +out = instance.compute_server.run_script("post", {"script": "add.py"}, verbose = True).json() |
| 22 | +print("RUN:") |
| 23 | +peepee(out) |
| 24 | +uid = out["uid"] |
| 25 | + |
| 26 | +out = instance.compute_server.get_script_status("post", {"uid": out["uid"]}, verbose = True).json() |
| 27 | +print("STATUS:") |
| 28 | +peepee(out) |
| 29 | + |
| 30 | +out = instance.compute_server.clear_jobs_db("get", verbose = True).json() |
| 31 | +print("CLEAR:") |
| 32 | +peepee(out) |
| 33 | + |
| 34 | +out = instance.compute_server.get_script_status("post", {"uid": uid}, verbose = True).json() |
| 35 | +print("STATUS:") |
| 36 | +peepee(out) |
| 37 | + |
| 38 | +# class Sample(): |
| 39 | +# def __init__(self): |
| 40 | +# pass |
| 41 | +# def __getattribute__(self, __name: str): |
| 42 | +# print(__name) |
| 43 | +# def __func(a, b): |
| 44 | +# return a + b |
| 45 | +# return __func |
| 46 | + |
| 47 | +# s = Sample() |
| 48 | +# print(s.add) |
| 49 | +# print(s.add(123, 123)) |
| 50 | +# print(s.multiply(123, 123)) |
0 commit comments