Clean Versions
Browse files
run.py
CHANGED
|
@@ -17,12 +17,9 @@ from aiflows.interfaces import KeyInterface
|
|
| 17 |
from aiflows.utils.colink_utils import start_colink_server
|
| 18 |
from aiflows.workers import run_dispatch_worker_thread
|
| 19 |
|
| 20 |
-
CACHING_PARAMETERS.do_caching = False # Set to True in order to disable caching
|
| 21 |
-
# clear_cache() # Uncomment this line to clear the cache
|
| 22 |
|
| 23 |
# logging.set_verbosity_debug()
|
| 24 |
|
| 25 |
-
|
| 26 |
dependencies = [
|
| 27 |
{"url": "aiflows/VisionFlowModule", "revision": os.getcwd()}
|
| 28 |
]
|
|
@@ -31,9 +28,7 @@ from aiflows import flow_verse
|
|
| 31 |
flow_verse.sync_dependencies(dependencies)
|
| 32 |
if __name__ == "__main__":
|
| 33 |
|
| 34 |
-
#1. ~~~~~ Set up a colink server ~~~~
|
| 35 |
-
FLOW_MODULES_PATH = "./"
|
| 36 |
-
|
| 37 |
cl = start_colink_server()
|
| 38 |
|
| 39 |
|
|
@@ -57,26 +52,22 @@ if __name__ == "__main__":
|
|
| 57 |
|
| 58 |
|
| 59 |
#3. ~~~~ Serve The Flow ~~~~
|
| 60 |
-
serve_utils.
|
| 61 |
cl = cl,
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
default_state=None,
|
| 65 |
-
default_dispatch_point="coflows_dispatch"
|
| 66 |
)
|
| 67 |
|
| 68 |
#4. ~~~~~Start A Worker Thread~~~~~
|
| 69 |
-
run_dispatch_worker_thread(cl
|
| 70 |
|
| 71 |
-
#5. ~~~~~Mount the flow and get
|
| 72 |
-
proxy_flow
|
| 73 |
cl=cl,
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
config_overrides=
|
| 77 |
-
|
| 78 |
-
dispatch_point_override=None,
|
| 79 |
-
)
|
| 80 |
|
| 81 |
#6. ~~~ Get the data ~~~
|
| 82 |
url_image = {"type": "url",
|
|
@@ -127,5 +118,5 @@ if __name__ == "__main__":
|
|
| 127 |
|
| 128 |
|
| 129 |
#9. ~~~~~Optional: Unserve Flow~~~~~~
|
| 130 |
-
# serve_utils.delete_served_flow(cl, "VisionFlowModule")
|
| 131 |
|
|
|
|
| 17 |
from aiflows.utils.colink_utils import start_colink_server
|
| 18 |
from aiflows.workers import run_dispatch_worker_thread
|
| 19 |
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# logging.set_verbosity_debug()
|
| 22 |
|
|
|
|
| 23 |
dependencies = [
|
| 24 |
{"url": "aiflows/VisionFlowModule", "revision": os.getcwd()}
|
| 25 |
]
|
|
|
|
| 28 |
flow_verse.sync_dependencies(dependencies)
|
| 29 |
if __name__ == "__main__":
|
| 30 |
|
| 31 |
+
#1. ~~~~~ Set up a colink server ~~~~
|
|
|
|
|
|
|
| 32 |
cl = start_colink_server()
|
| 33 |
|
| 34 |
|
|
|
|
| 52 |
|
| 53 |
|
| 54 |
#3. ~~~~ Serve The Flow ~~~~
|
| 55 |
+
serve_utils.serve_flow(
|
| 56 |
cl = cl,
|
| 57 |
+
flow_class_name="flow_modules.aiflows.VisionFlowModule.VisionAtomicFlow",
|
| 58 |
+
flow_endpoint="VisionAtomicFlow",
|
|
|
|
|
|
|
| 59 |
)
|
| 60 |
|
| 61 |
#4. ~~~~~Start A Worker Thread~~~~~
|
| 62 |
+
run_dispatch_worker_thread(cl)
|
| 63 |
|
| 64 |
+
#5. ~~~~~Mount the flow and get an instance of it via a proxy~~~~~~
|
| 65 |
+
proxy_flow= serve_utils.get_flow_instance(
|
| 66 |
cl=cl,
|
| 67 |
+
flow_endpoint="VisionAtomicFlow",
|
| 68 |
+
user_id="local",
|
| 69 |
+
config_overrides = cfg
|
| 70 |
+
)
|
|
|
|
|
|
|
| 71 |
|
| 72 |
#6. ~~~ Get the data ~~~
|
| 73 |
url_image = {"type": "url",
|
|
|
|
| 118 |
|
| 119 |
|
| 120 |
#9. ~~~~~Optional: Unserve Flow~~~~~~
|
| 121 |
+
# serve_utils.delete_served_flow(cl, "VisionFlowModule")
|
| 122 |
|