Skip to content

Commit

Permalink
Instance UX completed
Browse files Browse the repository at this point in the history
  • Loading branch information
yashbonde committed Dec 7, 2021
1 parent 9d01496 commit a74a88a
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 122 deletions.
1 change: 1 addition & 0 deletions assets/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def get_meta(r: Request, response: Response):
"model_path": fpath,
"source_serving": SERVING_MODE,
"nbox_version": nbox.__version__,
"model_name": model.name,
},
metadata = {
"signature_def": {
Expand Down
55 changes: 45 additions & 10 deletions example_jobs/simple_addition.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,50 @@
# this is an absolute overkill for just adding two numbers but we will
# still do it
# # this is an absolute overkill for just adding two numbers but we will
# # still do it

import time

from pprint import pprint as peepee

from nbox import Instance
from nbox.utils import nbox_session

instance = Instance("GPT4NBX", url = "https://test-2.nimblebox.ai")
print(instance)
# instance.test()
# instance.start(True, wait = True)
# instance.get_files()
instance.run_script("add.py")
instance.get_script_status("add.py")

# instance.stop(wait = True)
# instance = Instance.create("GPT4NBX", url = "https://test-2.nimblebox.ai")
instance.start(True)
# instance("add.py")
# instance.stop()

instance.compute_server.test("get").json()
instance.compute_server.get_files(
"post", {"dir_path": "/"}, verbose = True
).json()
out = instance.compute_server.run_script("post", {"script": "add.py"}, verbose = True).json()
print("RUN:")
peepee(out)
uid = out["uid"]

out = instance.compute_server.get_script_status("post", {"uid": out["uid"]}, verbose = True).json()
print("STATUS:")
peepee(out)

out = instance.compute_server.clear_jobs_db("get", verbose = True).json()
print("CLEAR:")
peepee(out)

out = instance.compute_server.get_script_status("post", {"uid": uid}, verbose = True).json()
print("STATUS:")
peepee(out)

# class Sample():
# def __init__(self):
# pass
# def __getattribute__(self, __name: str):
# print(__name)
# def __func(a, b):
# return a + b
# return __func

# s = Sample()
# print(s.add)
# print(s.add(123, 123))
# print(s.multiply(123, 123))
Loading

0 comments on commit a74a88a

Please sign in to comment.