Skip to content

Commit

Permalink
fix: filter with lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
andylizf committed Oct 1, 2024
1 parent 743a34e commit b824a59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions sky/jobs/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@


def _get_db_path() -> str:
"""
Workaround to collapse multi-step Path ops for type checker.
"""Workaround to collapse multi-step Path ops for type checker.
Ensures _DB_PATH is str, avoiding Union[Path, str] inference.
"""
path = pathlib.Path('~/.sky/spot_jobs.db')
Expand Down
3 changes: 1 addition & 2 deletions sky/serve/serve_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@


def _get_db_path() -> str:
"""
Workaround to collapse multi-step Path ops for type checker.
"""Workaround to collapse multi-step Path ops for type checker.
Ensures _DB_PATH is str, avoiding Union[Path, str] inference.
"""
path = pathlib.Path(constants.SKYSERVE_METADATA_DIR) / 'services.db'
Expand Down
5 changes: 3 additions & 2 deletions sky/serve/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ def _get_host():
finally:
# Kill load balancer process first since it will raise errors if failed
# to connect to the controller. Then the controller process.
process_to_kill = filter(lambda proc: proc is not None,
[load_balancer_process, controller_process])
process_to_kill = filter(None,
[load_balancer_process, controller_process
]) # filter out None from the list
subprocess_utils.kill_children_processes(
[process.pid for process in process_to_kill], force=True)
for process in process_to_kill:
Expand Down

0 comments on commit b824a59

Please sign in to comment.