diff --git a/fireworks/core/firework.py b/fireworks/core/firework.py index 69405d084..7368fa39c 100644 --- a/fireworks/core/firework.py +++ b/fireworks/core/firework.py @@ -643,7 +643,7 @@ def _update_state_history(self, state) -> None: now_time = datetime.utcnow() new_history_entry = {"state": state, "created_on": now_time} if state != "COMPLETED" and last_checkpoint: - new_history_entry.update({"checkpoint": last_checkpoint}) + new_history_entry.update(checkpoint=last_checkpoint) self.state_history.append(new_history_entry) if state in ["RUNNING", "RESERVED"]: self.touch_history() # add updated_on key diff --git a/fireworks/core/launchpad.py b/fireworks/core/launchpad.py index 5350de9e3..02a9fb43b 100644 --- a/fireworks/core/launchpad.py +++ b/fireworks/core/launchpad.py @@ -898,7 +898,7 @@ def future_run_exists(self, fworker=None) -> bool: return True # retrieve all [RUNNING/RESERVED] fireworks q = fworker.query if fworker else {} - q.update({"state": {"$in": ["RUNNING", "RESERVED"]}}) + q.update(state={"$in": ["RUNNING", "RESERVED"]}) active = self.get_fw_ids(q) # then check if they have WAITING children for fw_id in active: @@ -1670,7 +1670,7 @@ def rerun_fw(self, fw_id, rerun_duplicates=True, recover_launch=None, recover_mo # Launch recovery if recover_launch is not None: recovery = self.get_recovery(fw_id, recover_launch) - recovery.update({"_mode": recover_mode}) + recovery.update(_mode=recover_mode) set_spec = recursive_dict({"$set": {"spec._recovery": recovery}}) if recover_mode == "prev_dir": prev_dir = self.get_launch_by_id(recovery.get("_launch_id")).launch_dir @@ -1714,7 +1714,7 @@ def get_recovery(self, fw_id, launch_id="last"): m_fw = self.get_fw_by_id(fw_id) launch = m_fw.launches[-1] if launch_id == "last" else self.get_launch_by_id(launch_id) recovery = launch.state_history[-1].get("checkpoint") - recovery.update({"_prev_dir": launch.launch_dir, "_launch_id": launch.launch_id}) + recovery.update(_prev_dir=launch.launch_dir, _launch_id=launch.launch_id) return recovery def _refresh_wf(self, fw_id) -> None: diff --git a/fireworks/features/stats.py b/fireworks/features/stats.py index c381e64d6..402e5ef6b 100644 --- a/fireworks/features/stats.py +++ b/fireworks/features/stats.py @@ -197,8 +197,8 @@ def group_fizzled_fireworks( "created_on": self._query_datetime_range(start_time=query_start, end_time=query_end, **args), } if include_ids: - project_query.update({"fw_id": 1}) - group_query.update({"fw_id": {"$push": "$fw_id"}}) + project_query.update(fw_id=1) + group_query.update(fw_id={"$push": "$fw_id"}) if query: match_query.update(query) return self._aggregate( @@ -306,11 +306,11 @@ def _get_summary( } match_query.update(query) if runtime_stats: - project_query.update({"runtime_secs": 1}) + project_query.update(runtime_secs=1) group_query.update(RUNTIME_STATS) if include_ids: project_query.update({id_field: 1}) - group_query.update({"ids": {"$push": "$" + id_field}}) + group_query.update(ids={"$push": "$" + id_field}) return self._aggregate( coll=coll, match=match_query, @@ -357,7 +357,7 @@ def _aggregate( for arg in [match, project, unwind, group_op]: if arg is None: arg = {} - group_op.update({"_id": "$" + group_by}) + group_op.update(_id=f"${group_by}") if sort is None: sort_query = ("_id", 1) query = [{"$match": match}, {"$project": project}, {"$group": group_op}, {"$sort": SON([sort_query])}] diff --git a/fireworks/queue/queue_launcher.py b/fireworks/queue/queue_launcher.py index 3a271a9b2..e7d461abc 100644 --- a/fireworks/queue/queue_launcher.py +++ b/fireworks/queue/queue_launcher.py @@ -96,7 +96,7 @@ def launch_rocket_to_queue( # update qadapter job_name based on FW name job_name = get_slug(fw.name)[0:QUEUE_JOBNAME_MAXLEN] - qadapter.update({"job_name": job_name}) + qadapter.update(job_name=job_name) if "_queueadapter" in fw.spec: l_logger.debug("updating queue params using Firework spec..") diff --git a/fireworks/user_objects/queue_adapters/common_adapter.py b/fireworks/user_objects/queue_adapters/common_adapter.py index 6e1380b25..259d6ada7 100644 --- a/fireworks/user_objects/queue_adapters/common_adapter.py +++ b/fireworks/user_objects/queue_adapters/common_adapter.py @@ -66,7 +66,7 @@ def __init__(self, q_type, q_name=None, template_file=None, timeout=None, **kwar ) self.q_name = q_name or q_type self.timeout = timeout or 5 - self.update(dict(kwargs)) + self.update(kwargs) self.q_commands = copy.deepcopy(CommonAdapter.default_q_commands) if "_q_commands_override" in self: