Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
glemaitre committed Jan 25, 2025
1 parent 0b09039 commit a6b0978
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
17 changes: 4 additions & 13 deletions skore/src/skore/project/_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import multiprocessing
import os
import socket
import uuid
import webbrowser
from pathlib import Path
from typing import Union

import joblib
import platformdirs
import psutil
import uvicorn
Expand Down Expand Up @@ -84,18 +84,10 @@ class ServerInfo:
def _get_pid_file_path(project: Project) -> Path:
"""Get the path to the PID file."""
if project.path is not None:
project_identifier = uuid.uuid3(uuid.NAMESPACE_DNS, str(project.path))
project_identifier = joblib.hash(project.path, hash_name="sha1")
else:
project_identifier = uuid.uuid3(uuid.NAMESPACE_DNS, str(project.name))

# Print the content of the skore state directory
state_dir = platformdirs.user_state_path(appname="skore")
if state_dir.exists():
print(f"Content of {state_dir}:")
for path in state_dir.iterdir():
print(f" {path.name}")
else:
print(f"Directory {state_dir} does not exist")
project_identifier = joblib.hash(project.name, hash_name="sha1")

return (
platformdirs.user_state_path(appname="skore")
/ f"skore-server-{project_identifier}.json"
Expand All @@ -121,7 +113,6 @@ def rejoin(cls, project: Project):
The server information.
"""
pid_file = cls._get_pid_file_path(project)
print(pid_file)
if not pid_file.exists():
return

Expand Down
4 changes: 2 additions & 2 deletions skore/tests/unit/project/test_launch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import socket
import uuid

import joblib
import psutil
import pytest
from skore.project._create import _create
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_launch(capsys, tmp_path):
server_info = skore_project._server_info
pid_file_content = server_info.load_pid_file()
assert server_info.port == pid_file_content["port"]
project_identifier = uuid.uuid3(uuid.NAMESPACE_DNS, str(skore_project.path))
project_identifier = joblib.hash(skore_project.path, hash_name="sha1")
assert server_info.pid_file.name == f"skore-server-{project_identifier}.json"

skore_project.shutdown_web_ui()
Expand Down

0 comments on commit a6b0978

Please sign in to comment.