Skip to content

Commit a74a88a

Browse files
committed
Instance UX completed
1 parent 9d01496 commit a74a88a

File tree

4 files changed

+216
-122
lines changed

4 files changed

+216
-122
lines changed

assets/server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def get_meta(r: Request, response: Response):
5757
"model_path": fpath,
5858
"source_serving": SERVING_MODE,
5959
"nbox_version": nbox.__version__,
60+
"model_name": model.name,
6061
},
6162
metadata = {
6263
"signature_def": {

example_jobs/simple_addition.py

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,50 @@
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
37

48
from nbox import Instance
59
from nbox.utils import nbox_session
610

711
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

Comments
 (0)