oocana-python-executor 0.16.9__tar.gz → 0.16.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/PKG-INFO +1 -1
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/pyproject.toml +1 -1
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/context.py +12 -1
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/executor.py +17 -26
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/__init__.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/block.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/data.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/hook.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/logger.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/matplot/matplotlib_oomol/__init__.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/matplot/matplotlib_oomol/oomol.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/matplot/oomol_matplot_helper.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/secret.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/service.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/topic.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/utils.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/tests/test_cli.py +0 -0
- {oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/tests/test_secret.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: oocana-python-executor
|
|
3
|
-
Version: 0.16.
|
|
3
|
+
Version: 0.16.11
|
|
4
4
|
Summary: a client subscribe mqtt topic to execute oocana's block
|
|
5
5
|
Author-Email: l1shen <lishen1635@gmail.com>, yleaf <11785335+leavesster@users.noreply.github.com>
|
|
6
6
|
License: MIT
|
|
@@ -59,7 +59,18 @@ def createContext(
|
|
|
59
59
|
|
|
60
60
|
blockInfo = BlockInfo(**node_props)
|
|
61
61
|
|
|
62
|
-
ctx = Context(
|
|
62
|
+
ctx = Context(
|
|
63
|
+
inputs=inputs,
|
|
64
|
+
inputs_def=inputs_def,
|
|
65
|
+
blockInfo=blockInfo,
|
|
66
|
+
mainframe=mainframe,
|
|
67
|
+
store=store,
|
|
68
|
+
outputs_def=output,
|
|
69
|
+
session_dir=session_dir,
|
|
70
|
+
tmp_dir=tmp_dir,
|
|
71
|
+
package_name=package_name,
|
|
72
|
+
pkg_dir=pkg_dir
|
|
73
|
+
)
|
|
63
74
|
# 跟 executor 日志分开,避免有的库在 logger 里面使用 print,导致 hook 出现递归调用。
|
|
64
75
|
block_logger = logging.getLogger(f"block {job_id}")
|
|
65
76
|
ctx_handler = ContextHandler(ctx)
|
{oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/executor.py
RENAMED
|
@@ -91,7 +91,6 @@ async def run_executor(address: str, session_id: str, tmp_dir: str, package: str
|
|
|
91
91
|
# 目前的 mqtt 库,在 subscribe 回调里 publish 消息会导致死锁无法工作,参考 https://github.com/eclipse/paho.mqtt.python/issues/527 或者 https://stackoverflow.com/a/36964192/4770006
|
|
92
92
|
# 通过这种方式来绕过,所有需要 callback 后 publish message 的情况,都需要使用 future 类似方式来绕过。
|
|
93
93
|
fs = queue.Queue()
|
|
94
|
-
loop = asyncio.get_event_loop()
|
|
95
94
|
|
|
96
95
|
def execute_block(message):
|
|
97
96
|
if not_current_session(message):
|
|
@@ -108,9 +107,7 @@ async def run_executor(address: str, session_id: str, tmp_dir: str, package: str
|
|
|
108
107
|
job_set.add(job_id)
|
|
109
108
|
|
|
110
109
|
nonlocal fs
|
|
111
|
-
|
|
112
|
-
fs.put(f)
|
|
113
|
-
f.set_result(message)
|
|
110
|
+
fs.put(message)
|
|
114
111
|
|
|
115
112
|
def execute_service_block(message):
|
|
116
113
|
if not_current_session(message):
|
|
@@ -119,10 +116,7 @@ async def run_executor(address: str, session_id: str, tmp_dir: str, package: str
|
|
|
119
116
|
if not_current_job(message):
|
|
120
117
|
return
|
|
121
118
|
|
|
122
|
-
|
|
123
|
-
f = loop.create_future()
|
|
124
|
-
fs.put(f)
|
|
125
|
-
f.set_result(message)
|
|
119
|
+
fs.put(message)
|
|
126
120
|
|
|
127
121
|
def service_exit(message: ReportStatusPayload):
|
|
128
122
|
service_hash = message.get("service_hash")
|
|
@@ -203,24 +197,21 @@ async def run_executor(address: str, session_id: str, tmp_dir: str, package: str
|
|
|
203
197
|
mainframe.publish(run_action_topic(params), message)
|
|
204
198
|
|
|
205
199
|
while True:
|
|
206
|
-
|
|
207
|
-
if
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if not_current_session(message):
|
|
222
|
-
continue
|
|
223
|
-
run_block_in_new_thread(message, mainframe, session_dir=session_dir, tmp_dir=tmp_dir, package_name=package_name, pkg_dir=pkg_dir)
|
|
200
|
+
message = fs.get()
|
|
201
|
+
if message.get("service_executor") is not None:
|
|
202
|
+
service_hash = message.get("service_hash")
|
|
203
|
+
status = service_store.get(service_hash)
|
|
204
|
+
if status is None:
|
|
205
|
+
await spawn_service(message, service_hash)
|
|
206
|
+
elif status == "running":
|
|
207
|
+
run_service_block(message)
|
|
208
|
+
elif status == "launching":
|
|
209
|
+
logger.info(f"service {service_hash} is launching, set message back to fs to wait next time")
|
|
210
|
+
fs.put(message)
|
|
211
|
+
else:
|
|
212
|
+
if not_current_session(message):
|
|
213
|
+
continue
|
|
214
|
+
run_block_in_new_thread(message, mainframe, session_dir=session_dir, tmp_dir=tmp_dir, package_name=package_name, pkg_dir=pkg_dir)
|
|
224
215
|
|
|
225
216
|
def run_block_in_new_thread(message, mainframe: Mainframe, session_dir: str, tmp_dir: str, package_name: str, pkg_dir: str):
|
|
226
217
|
|
{oocana_python_executor-0.16.9 → oocana_python_executor-0.16.11}/python_executor/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|