ivoryos 1.3.7__py3-none-any.whl → 1.3.9__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.

Potentially problematic release.


This version of ivoryos might be problematic. Click here for more details.

@@ -17,14 +17,14 @@ class NIMOOptimizer(OptimizerBase):
17
17
  {"name": "param_3", "type": "range", "bounds": [0 10], "value_type": "int"},
18
18
  ]
19
19
  :param objective_config: objective configuration
20
- [
20
+ [
21
21
  {"name": "obj_1", "minimize": True, "weight": 1},
22
22
  {"name": "obj_2", "minimize": False, "weight": 1}
23
23
  ]
24
24
  :param optimizer_config: optimizer configuration
25
- optimizer_config={
26
- "step_1": {"model": "Random", "num_samples": 10},
27
- "step_2": {"model": "BOTorch"}
25
+ {
26
+ "step_1": {"model": "RE", "num_samples": 10},
27
+ "step_2": {"model": "PDC"}
28
28
  }
29
29
  """
30
30
  self.current_step = 0
@@ -35,13 +35,15 @@ class NIMOOptimizer(OptimizerBase):
35
35
 
36
36
  super().__init__(experiment_name, parameter_space, objective_config, optimizer_config, datapath)
37
37
 
38
+ os.makedirs(os.path.join(self.datapath, "nimo_data"), exist_ok=True)
39
+
38
40
  step_1 = optimizer_config.get("step_1", {})
39
41
  step_2 = optimizer_config.get("step_2", {})
40
42
  self.step_1_generator = step_1.get("model", "RE")
41
43
  self.step_1_batch_num = step_1.get("num_samples", 1)
42
44
  self.step_2_generator = step_2.get("model", "PDC")
43
- self.candidates = os.path.join(self.datapath, f"{self.experiment_name}_candidates.csv")
44
- self.proposals = os.path.join(self.datapath, f"{self.experiment_name}_proposals.csv")
45
+ self.candidates = os.path.join(self.datapath, "nimo_data", f"{self.experiment_name}_candidates.csv")
46
+ self.proposals = os.path.join(self.datapath, "nimo_data", f"{self.experiment_name}_proposals.csv")
45
47
  self.n_objectives = len(self.objective_config)
46
48
  self._create_candidates_csv()
47
49
 
@@ -129,8 +131,8 @@ class NIMOOptimizer(OptimizerBase):
129
131
  "parameter_types": ["choice"],
130
132
  "multiple_objectives": True,
131
133
  "optimizer_config": {
132
- "step_1": {"model": ["RE", "ES", "PDC"], "num_samples": 5},
133
- "step_2": {"model": ["PHYSBO", "BLOX", "PTR", "SLESA", "BOMP", "COMBI"]}
134
+ "step_1": {"model": ["RE", "ES"], "num_samples": 5},
135
+ "step_2": {"model": ["PHYSBO", "PDC", "BLOX", "PTR", "SLESA", "BOMP", "COMBI"]}
134
136
  },
135
137
  }
136
138
 
@@ -184,7 +184,7 @@ def run_bo():
184
184
  if not Optimizer:
185
185
  raise ValueError(f"Optimizer {optimizer_type} is not supported or not found.")
186
186
  optimizer = Optimizer(experiment_name=run_name, parameter_space=parameters, objective_config=objectives,
187
- optimizer_config=steps)
187
+ optimizer_config=steps, datapath=datapath)
188
188
  runner.run_script(script=script, run_name=run_name, optimizer=optimizer,
189
189
  logger=g.logger, socketio=g.socketio, repeat_count=repeat,
190
190
  output_path=datapath, compiled=False, history=existing_data,
@@ -110,6 +110,8 @@ class ScriptRunner:
110
110
  :return: The final result of the function execution
111
111
  """
112
112
  _func_str = script.python_script or script.compile()
113
+ _, return_list = script.config_return()
114
+
113
115
  step_list: list = script.convert_to_lines(_func_str).get(section_name, [])
114
116
  global deck
115
117
  # global deck, registered_workflows
@@ -230,8 +232,8 @@ class ScriptRunner:
230
232
  # step_list: list = script.convert_to_lines(_func_str).get(section_name, [])
231
233
  if not step.run_error or not self.retry:
232
234
  index += 1
233
-
234
- return exec_locals # Return the 'results' variable
235
+ output = {key: value for key, value in exec_locals.items() if key in return_list}
236
+ return output # Return the 'results' variable
235
237
 
236
238
  def _run_with_stop_check(self, script: Script, repeat_count: int, run_name: str, logger, socketio, config, bo_args,
237
239
  output_path, current_app, compiled, history=None, optimizer=None):
@@ -250,6 +252,8 @@ class ScriptRunner:
250
252
  db.session.add(run)
251
253
  db.session.flush()
252
254
  run_id = run.id # Save the ID
255
+ db.session.commit()
256
+
253
257
  try:
254
258
 
255
259
  global_config.runner_status = {"id":run_id, "type": "workflow"}
@@ -281,10 +285,13 @@ class ScriptRunner:
281
285
  self.lock.release()
282
286
  with current_app.app_context():
283
287
  run = db.session.get(WorkflowRun, run_id)
284
- run.end_time = datetime.now()
285
- run.data_path = filename
286
- run.run_error = error_flag
287
- db.session.commit()
288
+ if run is None:
289
+ logger.info("Error: Run not found in database.")
290
+ else:
291
+ run.end_time = datetime.now()
292
+ run.data_path = filename
293
+ run.run_error = error_flag
294
+ db.session.commit()
288
295
 
289
296
 
290
297
  def _run_actions(self, script, section_name="", logger=None, socketio=None, run_id=None):
@@ -422,6 +429,7 @@ class ScriptRunner:
422
429
  except Exception as e:
423
430
  logger.info(f'Optimization error: {e}')
424
431
  break
432
+ # Optimizer for UI
425
433
  elif optimizer:
426
434
  try:
427
435
  parameters = optimizer.suggest(1)
ivoryos/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.3.7"
1
+ __version__ = "1.3.9"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ivoryos
3
- Version: 1.3.7
3
+ Version: 1.3.9
4
4
  Summary: an open-source Python package enabling Self-Driving Labs (SDLs) interoperability
5
5
  Author-email: Ivory Zhang <ivoryzhang@chem.ubc.ca>
6
6
  License: MIT
@@ -3,11 +3,11 @@ ivoryos/app.py,sha256=G6kzEOVzCduj7Fc2r1rMbMFHgDzZQV0lC20Oxps7RSM,4839
3
3
  ivoryos/config.py,sha256=y3RxNjiIola9tK7jg-mHM8EzLMwiLwOzoisXkDvj0gA,2174
4
4
  ivoryos/server.py,sha256=Idr41Boa8rPsh3bVJ8xy2Flwfxa1Xu6f2T0oMp4qBEk,7121
5
5
  ivoryos/socket_handlers.py,sha256=VWVWiIdm4jYAutwGu6R0t1nK5MuMyOCL0xAnFn06jWQ,1302
6
- ivoryos/version.py,sha256=9peaXOar2qezOPJEKG6cD_A0aaXrzdVN8h-v6fBoBEk,22
6
+ ivoryos/version.py,sha256=SaWgUI6v92kVfF_Qdoxbfc38bwA34RuDGZmXMqa5g3c,22
7
7
  ivoryos/optimizer/ax_optimizer.py,sha256=k7RzhNMjh3MseOE-_FADVX72lYLDyXz-XE3juSBRWTk,7116
8
8
  ivoryos/optimizer/base_optimizer.py,sha256=gNBX9m3RxoYklwEBkqeDGZlU7c6e9e5kN0ZeTtnxnCE,2044
9
9
  ivoryos/optimizer/baybe_optimizer.py,sha256=EdrrRiYO-IOx610cPXiQhH4qG8knUP0uiZ0YoyaGIU8,7954
10
- ivoryos/optimizer/nimo_optimizer.py,sha256=J1nR1gMI4LqOkKqqdc5Pq7r3e3R8QQTJ-TZ9l9GVPQE,6696
10
+ ivoryos/optimizer/nimo_optimizer.py,sha256=kewmRM8wteFROUMdlQeCLanaBfBMCfP8gXSb3kTjYLM,6767
11
11
  ivoryos/optimizer/registry.py,sha256=dLMo5cszcwa06hfBxdINQIGpkHtRe5-J3J7t76Jq6X0,306
12
12
  ivoryos/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  ivoryos/routes/api/api.py,sha256=97Y7pqTwOaWgZgI5ovEPxEBm6Asrt0Iy0VhBkVp2xqA,2304
@@ -52,7 +52,7 @@ ivoryos/routes/design/templates/components/modals/new_script_modal.html,sha256=p
52
52
  ivoryos/routes/design/templates/components/modals/rename_modal.html,sha256=40rLNF9JprdXekB3mv_S3OdqVuQYOe-BZSCgOnIkxJQ,1202
53
53
  ivoryos/routes/design/templates/components/modals/saveas_modal.html,sha256=N5PEqUuK3qxDFbtDKFnzHwhLarQLPHiX-XQAdQPL1AU,1555
54
54
  ivoryos/routes/execute/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
- ivoryos/routes/execute/execute.py,sha256=lxJ0jHILomJ9kRBlqcnuScC6DTHVDJZRNTwz1ZC4yR8,12428
55
+ ivoryos/routes/execute/execute.py,sha256=jCdElrV_ufzWDgtQr0UT4Ura16nFHcNVq_DwcPM1Kmo,12447
56
56
  ivoryos/routes/execute/execute_file.py,sha256=TelWYV295p4ZPhkUDJSVxfYROfVaKodEmDPTS2plQHI,2816
57
57
  ivoryos/routes/execute/templates/experiment_run.html,sha256=D-ek7ISQrIQXy4PH37TnsURihbGNdpCgdTC8w79cwQc,10355
58
58
  ivoryos/routes/execute/templates/components/error_modal.html,sha256=5Dmp9V0Ys6781Y-pKn_mc4N9J46c8EwIkjkHX22xCsw,1025
@@ -93,12 +93,12 @@ ivoryos/utils/form.py,sha256=f1yXHlOQX1YnJ2j_UW6iHmh4pTAGAs9sAlhyQB8yBIo,22505
93
93
  ivoryos/utils/global_config.py,sha256=leYoEXvAS0AH4xQpYsqu4HI9CJ9-wiLM-pIh_bEG4Ak,3087
94
94
  ivoryos/utils/llm_agent.py,sha256=-lVCkjPlpLues9sNTmaT7bT4sdhWvV2DiojNwzB2Lcw,6422
95
95
  ivoryos/utils/py_to_json.py,sha256=ZtejHgwdEAUCVVMYeVNR8G7ceLINue294q6WpiJ6jn0,9734
96
- ivoryos/utils/script_runner.py,sha256=gIYdTEFNWZFmPf9cf31y3wAUKUeJk_qnjohYDKevWNw,20749
96
+ ivoryos/utils/script_runner.py,sha256=9xlUOhb9G27jksNsu1SDAlosnfb-0K0xXOHgLsxFwjw,21073
97
97
  ivoryos/utils/serilize.py,sha256=lkBhkz8r2bLmz2_xOb0c4ptSSOqjIu6krj5YYK4Nvj8,6784
98
98
  ivoryos/utils/task_runner.py,sha256=xiMzK8gQ0mHsg0A1Ah8fmXe3azpaJh4hJiQJLHA11ZQ,3682
99
99
  ivoryos/utils/utils.py,sha256=dIc4BO55eS3lCA0nhbIncS5d7sLaKZy5hJS1I_Sm45o,14949
100
- ivoryos-1.3.7.dist-info/licenses/LICENSE,sha256=p2c8S8i-8YqMpZCJnadLz1-ofxnRMILzz6NCMIypRag,1084
101
- ivoryos-1.3.7.dist-info/METADATA,sha256=b4vaTs88sF290jix6Yiwlw0RbwIVUoNiDUg2KfjTWXM,8516
102
- ivoryos-1.3.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
103
- ivoryos-1.3.7.dist-info/top_level.txt,sha256=FRIWWdiEvRKqw-XfF_UK3XV0CrnNb6EmVbEgjaVazRM,8
104
- ivoryos-1.3.7.dist-info/RECORD,,
100
+ ivoryos-1.3.9.dist-info/licenses/LICENSE,sha256=p2c8S8i-8YqMpZCJnadLz1-ofxnRMILzz6NCMIypRag,1084
101
+ ivoryos-1.3.9.dist-info/METADATA,sha256=XgdSDR0_DjiA3C_WxAvSBsLZIKCBsb-bq_gw6WPwg7M,8516
102
+ ivoryos-1.3.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
103
+ ivoryos-1.3.9.dist-info/top_level.txt,sha256=FRIWWdiEvRKqw-XfF_UK3XV0CrnNb6EmVbEgjaVazRM,8
104
+ ivoryos-1.3.9.dist-info/RECORD,,