Skip to content

Commit

Permalink
try revert LaunchPad
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Apr 26, 2024
1 parent 2b357d5 commit 711d4ac
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions fireworks/core/launchpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ def __init__(

# set up logger
self.logdir = logdir
self.strm_lvl = strm_lvl or "INFO"
self.strm_lvl = strm_lvl if strm_lvl else "INFO"
self.m_logger = get_fw_logger("launchpad", l_dir=self.logdir, stream_level=self.strm_lvl)

self.user_indices = user_indices or []
self.wf_user_indices = wf_user_indices or []
self.user_indices = user_indices if user_indices else []
self.wf_user_indices = wf_user_indices if wf_user_indices else []

# get connection
if uri_mode:
Expand Down Expand Up @@ -344,7 +344,7 @@ def maintain(self, infinite=True, maintain_interval=None) -> None:
infinite (bool)
maintain_interval (seconds): sleep time
"""
maintain_interval = maintain_interval or MAINTAIN_INTERVAL
maintain_interval = maintain_interval if maintain_interval else MAINTAIN_INTERVAL

while True:
self.m_logger.info("Performing maintenance on Launchpad...")
Expand Down Expand Up @@ -729,7 +729,7 @@ def get_fw_ids(self, query=None, sort=None, limit=0, count_only=False, launches_
list: list of firework ids matching the query
"""
coll = "launches" if launches_mode else "fireworks"
criteria = query or {}
criteria = query if query else {}
if launches_mode:
lids = self._get_active_launch_ids()
criteria["launch_id"] = {"$in": lids}
Expand Down Expand Up @@ -775,7 +775,7 @@ def get_wf_ids(self, query=None, sort=None, limit=0, count_only=False):
Returns:
list: list of firework ids
"""
criteria = query or {}
criteria = query if query else {}
aggregation = []

if criteria is not None:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 711d4ac

Please sign in to comment.