-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# this code adds two numbers | ||
|
||
import time | ||
|
||
a = 123 | ||
b = 123 | ||
|
||
time.sleep(60) | ||
|
||
print(a * 2 if a == b else a + b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# this is an absolute overkill for just adding two numbers but we will still do it | ||
|
||
from nbox import Instance | ||
from pprint import pprint as peepee | ||
|
||
instance = Instance("GPT4NBX", url = "https://test-2.nimblebox.ai") | ||
# instance = Instance.create("GPT4NBX", url = "https://test-2.nimblebox.ai") | ||
|
||
instance.compute_server.test("get") | ||
instance.compute_server.get_files( | ||
"post", {"dir_path": "/"}, verbose = True | ||
) | ||
out = instance.compute_server.run_script("post", {"script": "add.py"}, verbose = True) | ||
print("RUN:") | ||
peepee(out) | ||
uid = out["uid"] | ||
|
||
out = instance.compute_server.get_script_status("post", {"uid": out["uid"]}, verbose = True) | ||
print("STATUS:") | ||
peepee(out) | ||
|
||
out = instance.compute_server.clear_jobs_db("get", verbose = True) | ||
print("CLEAR:") | ||
peepee(out) | ||
|
||
out = instance.compute_server.get_script_status("post", {"uid": uid}, verbose = True) | ||
print("STATUS:") | ||
peepee(out) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,11 @@ | ||
# # this is an absolute overkill for just adding two numbers but we will | ||
# # still do it | ||
|
||
import time | ||
|
||
from pprint import pprint as peepee | ||
# this is an absolute overkill for just adding two numbers but we will still do it | ||
|
||
from nbox import Instance | ||
from nbox.utils import nbox_session | ||
|
||
instance = Instance("GPT4NBX", url = "https://test-2.nimblebox.ai") | ||
# 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)) | ||
instance.start(True) | ||
my_uid = instance("add.py") | ||
print("My UID:", my_uid) | ||
instance(my_uid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters