bohr-agent-sdk 0.1.19__py3-none-any.whl → 0.1.20__py3-none-any.whl
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.
- {bohr_agent_sdk-0.1.19.dist-info → bohr_agent_sdk-0.1.20.dist-info}/METADATA +1 -1
- {bohr_agent_sdk-0.1.19.dist-info → bohr_agent_sdk-0.1.20.dist-info}/RECORD +6 -6
- dp/agent/server/executor/dispatcher_executor.py +16 -13
- {bohr_agent_sdk-0.1.19.dist-info → bohr_agent_sdk-0.1.20.dist-info}/WHEEL +0 -0
- {bohr_agent_sdk-0.1.19.dist-info → bohr_agent_sdk-0.1.20.dist-info}/entry_points.txt +0 -0
- {bohr_agent_sdk-0.1.19.dist-info → bohr_agent_sdk-0.1.20.dist-info}/top_level.txt +0 -0
|
@@ -25,7 +25,7 @@ dp/agent/server/preprocessor.py,sha256=XUWu7QOwo_sIDMYS2b1OTrM33EXEVH_73vk-ju1Ok
|
|
|
25
25
|
dp/agent/server/utils.py,sha256=8jgYZEW4XBp86AF2Km6QkwHltBmrnS-soTpHov7ZEJw,4501
|
|
26
26
|
dp/agent/server/executor/__init__.py,sha256=s95M5qKQk39Yi9qaVJZhk_nfj54quSf7EDghR3OCFUA,248
|
|
27
27
|
dp/agent/server/executor/base_executor.py,sha256=EFJBsYVYAvuRbiLAbLOwLTw3h7ScjN025xnSP4uJHrQ,2052
|
|
28
|
-
dp/agent/server/executor/dispatcher_executor.py,sha256=
|
|
28
|
+
dp/agent/server/executor/dispatcher_executor.py,sha256=urpzmKH_tBOgblBdJEa3y8eEhXqUDrdcdWCnUdJpfZk,9420
|
|
29
29
|
dp/agent/server/executor/local_executor.py,sha256=alNpEPicZQOQMtXc1vqGSo4El_9agXAJ5ldqi-OJGL4,3887
|
|
30
30
|
dp/agent/server/storage/__init__.py,sha256=Sgsyp5hb0_hhIGugAPfQFzBHt_854rS_MuMuE3sn8Gs,389
|
|
31
31
|
dp/agent/server/storage/base_storage.py,sha256=728-oNG6N8isV95gZVnyi4vTznJPJhSjxw9Gl5Y_y5o,2356
|
|
@@ -33,8 +33,8 @@ dp/agent/server/storage/bohrium_storage.py,sha256=EsKX4dWWvZTn2TEhZv4zsvihfDK0mm
|
|
|
33
33
|
dp/agent/server/storage/http_storage.py,sha256=KiySq7g9-iJr12XQCKKyJLn8wJoDnSRpQAR5_qPJ1ZU,1471
|
|
34
34
|
dp/agent/server/storage/local_storage.py,sha256=t1wfjByjXew9ws3PuUxWxmZQ0-Wt1a6t4wmj3fW62GI,1352
|
|
35
35
|
dp/agent/server/storage/oss_storage.py,sha256=pgjmi7Gir3Y5wkMDCvU4fvSls15fXT7Ax-h9MYHFPK0,3359
|
|
36
|
-
bohr_agent_sdk-0.1.
|
|
37
|
-
bohr_agent_sdk-0.1.
|
|
38
|
-
bohr_agent_sdk-0.1.
|
|
39
|
-
bohr_agent_sdk-0.1.
|
|
40
|
-
bohr_agent_sdk-0.1.
|
|
36
|
+
bohr_agent_sdk-0.1.20.dist-info/METADATA,sha256=ZEoxrydj541JG9txn0Wr0iARoxZ_w2KA6E0aJFFGlAY,6329
|
|
37
|
+
bohr_agent_sdk-0.1.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
38
|
+
bohr_agent_sdk-0.1.20.dist-info/entry_points.txt,sha256=5n5kneF5IbDQtoQ2WfF-QuBjDtsimJte9Rv9baSGgc0,86
|
|
39
|
+
bohr_agent_sdk-0.1.20.dist-info/top_level.txt,sha256=87xLUDhu_1nQHoGLwlhJ6XlO7OsjILh6i1nX6ljFzDo,3
|
|
40
|
+
bohr_agent_sdk-0.1.20.dist-info/RECORD,,
|
|
@@ -12,12 +12,15 @@ from dpdispatcher import Machine, Resources, Task, Submission
|
|
|
12
12
|
|
|
13
13
|
from .base_executor import BaseExecutor
|
|
14
14
|
from .... import __path__
|
|
15
|
+
|
|
15
16
|
config = {
|
|
16
17
|
"username": os.environ.get("BOHRIUM_USERNAME", ""),
|
|
17
18
|
"password": os.environ.get("BOHRIUM_PASSWORD", ""),
|
|
18
19
|
"project_id": os.environ.get("BOHRIUM_PROJECT_ID", ""),
|
|
19
20
|
"access_key": os.environ.get("BOHRIUM_ACCESS_KEY", ""),
|
|
20
21
|
"app_key": os.environ.get("BOHRIUM_APP_KEY", "agent"),
|
|
22
|
+
"bohrium_url": os.environ.get("BOHRIUM_BOHRIUM_URL",
|
|
23
|
+
"https://bohrium.dp.tech"),
|
|
21
24
|
}
|
|
22
25
|
logger = logging.getLogger(__name__)
|
|
23
26
|
|
|
@@ -26,17 +29,17 @@ def get_source_code(fn):
|
|
|
26
29
|
source_lines, start_line = inspect.getsourcelines(fn)
|
|
27
30
|
source_file = inspect.getsourcefile(fn)
|
|
28
31
|
with open(source_file, "r", encoding="utf-8") as fd:
|
|
29
|
-
pre_lines = fd.readlines()[:start_line-1]
|
|
32
|
+
pre_lines = fd.readlines()[:start_line - 1]
|
|
30
33
|
return "".join(pre_lines + source_lines) + "\n"
|
|
31
34
|
|
|
32
35
|
|
|
33
36
|
class DispatcherExecutor(BaseExecutor):
|
|
34
37
|
def __init__(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
self,
|
|
39
|
+
machine=None,
|
|
40
|
+
resources=None,
|
|
41
|
+
python_packages=None,
|
|
42
|
+
python_executable="python3",
|
|
40
43
|
):
|
|
41
44
|
"""Use DPDispatcher to execute the tool
|
|
42
45
|
Refer to https://docs.deepmodeling.com/projects/dpdispatcher.
|
|
@@ -107,7 +110,7 @@ class DispatcherExecutor(BaseExecutor):
|
|
|
107
110
|
script += "if __name__ == \"__main__\":\n"
|
|
108
111
|
script += " cwd = os.getcwd()\n"
|
|
109
112
|
script += " kwargs = jsonpickle.loads(r'''%s''')\n" % \
|
|
110
|
-
|
|
113
|
+
jsonpickle.dumps(kwargs)
|
|
111
114
|
script += " try:\n"
|
|
112
115
|
if import_func_line is not None:
|
|
113
116
|
script += " " + import_func_line
|
|
@@ -118,8 +121,8 @@ class DispatcherExecutor(BaseExecutor):
|
|
|
118
121
|
script += " if isinstance(results, dict):\n"
|
|
119
122
|
script += " for name in results:\n"
|
|
120
123
|
script += " if isinstance(results[name], Path):\n"
|
|
121
|
-
script += " results[name] = "\
|
|
122
|
-
|
|
124
|
+
script += " results[name] = " \
|
|
125
|
+
"results[name].absolute().relative_to(cwd)\n"
|
|
123
126
|
script += " except Exception as e:\n"
|
|
124
127
|
script += " os.chdir(cwd)\n"
|
|
125
128
|
script += " with open('err', 'w') as f:\n"
|
|
@@ -173,8 +176,8 @@ class DispatcherExecutor(BaseExecutor):
|
|
|
173
176
|
extra_info = {
|
|
174
177
|
"bohr_job_id": bohr_job_id,
|
|
175
178
|
"bohr_group_id": bohr_group_id,
|
|
176
|
-
"job_link": "
|
|
177
|
-
|
|
179
|
+
"job_link": f"{config['bohrium_url']}/jobs/detail/%s" %
|
|
180
|
+
bohr_job_id,
|
|
178
181
|
}
|
|
179
182
|
logger.info(extra_info)
|
|
180
183
|
res["extra_info"] = extra_info
|
|
@@ -182,8 +185,8 @@ class DispatcherExecutor(BaseExecutor):
|
|
|
182
185
|
bohr_job_id = submission.belonging_jobs[0].job_id
|
|
183
186
|
extra_info = {
|
|
184
187
|
"bohr_job_id": bohr_job_id,
|
|
185
|
-
"job_link": "
|
|
186
|
-
|
|
188
|
+
"job_link": f"{config['bohrium_url']}/jobs/detail/%s" %
|
|
189
|
+
bohr_job_id,
|
|
187
190
|
}
|
|
188
191
|
logger.info(extra_info)
|
|
189
192
|
res["extra_info"] = extra_info
|
|
File without changes
|
|
File without changes
|
|
File without changes
|