Skip to content

Commit

Permalink
Refactor db session close
Browse files Browse the repository at this point in the history
  • Loading branch information
Only-bottle committed Dec 6, 2024
1 parent 38f0abf commit b0038e7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions netspresso/netspresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def create_project(self, project_name: str, project_path: str = "./projects") ->
logger.error(f"Failed to save project '{project_name}' to the database: {e}")
raise
finally:
if db:
db.close()
db and db.close()

def get_projects(self) -> List[Project]:
db = None
Expand All @@ -96,8 +95,7 @@ def get_projects(self) -> List[Project]:
logger.error(f"Failed to get project list from the database: {e}")
raise
finally:
if db:
db.close()
db and db.close()

def trainer(
self, task: Optional[Union[str, Task]] = None, yaml_path: Optional[str] = None
Expand Down

0 comments on commit b0038e7

Please sign in to comment.