Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/experimaestro/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def __init__(self, iterable=None, file=None, *args, **kwargs):
_file = file or sys.stderr
self.is_tty = hasattr(_file, "isatty") or _file.isatty()

super().__init__(iterable, disable=False, file=file, *args, **kwargs)
kwargs.setdefault("disable", False)
super().__init__(iterable, file=file, *args, **kwargs)
progress(0.0, level=self.pos, desc=kwargs.get("desc", None), console=False)

def update(self, n=1):
Expand Down
4 changes: 4 additions & 0 deletions src/experimaestro/scheduler/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,10 @@ def full_state_dict(self) -> Dict[str, Any]:
"description": self.description(),
"class": f"{self.__class__.__module__}.{self.__class__.__name__}",
"state_dict": self.state_dict(),
"experiment_id": self.experiment_id,
"run_id": self.run_id,
"state": self.state.name if hasattr(self.state, "name") else str(self.state),
"url": getattr(self, "url", None),
}

def to_service(self) -> "BaseService":
Expand Down
4 changes: 4 additions & 0 deletions src/experimaestro/scheduler/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ def full_state_dict(self) -> dict:
"description": self.description(),
"class": f"{self.__class__.__module__}.{self.__class__.__name__}",
"state_dict": self.serialize_state_dict(self.state_dict()),
"experiment_id": self.experiment_id,
"run_id": self.run_id,
"state": self.state.name if hasattr(self.state, "name") else str(self.state),
"url": getattr(self, "url", None),
}

@staticmethod
Expand Down
7 changes: 6 additions & 1 deletion src/experimaestro/scheduler/state_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -2025,6 +2025,10 @@ def full_state_dict(self) -> dict:
"description": self._description,
"class": self._service_class,
"state_dict": self._state_dict_data,
"experiment_id": self.experiment_id,
"run_id": self.run_id,
"state": self.state.name if hasattr(self.state, "name") else str(self.state),
"url": self.url,
}

@property
Expand All @@ -2040,7 +2044,7 @@ def from_full_state_dict(cls, d: Dict) -> "MockService":
d: Dictionary from full_state_dict()

Returns:
MockService instance (state is always MOCK, not from dict)
MockService instance
"""
return cls(
service_id=d["service_id"],
Expand All @@ -2050,6 +2054,7 @@ def from_full_state_dict(cls, d: Dict) -> "MockService":
experiment_id=d.get("experiment_id"),
run_id=d.get("run_id"),
url=d.get("url"),
state=d.get("state"),
)

def to_service(self) -> "BaseService":
Expand Down
4 changes: 4 additions & 0 deletions src/experimaestro/tests/test_remote_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ def test_serialize_mock_service(self):
# Preserves original service class, not MockService's class name
assert result["class"] == "mymodule.MyService"
assert result["state_dict"] == {"port": 8080}
assert result["experiment_id"] == "exp1"
assert result["run_id"] == "run1"
assert result["url"] == "http://localhost:8080"
assert result["state"] == "STOPPED"

def test_serialize_mock_service_no_class(self):
"""Test serializing a MockService with service_class=None"""
Expand Down
10 changes: 10 additions & 0 deletions src/experimaestro/tui/widgets/global_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def _load_services(self) -> None:

try:
all_services = self.state_provider.get_services()
for s in all_services:
self.log.info(
f"DEBUG: raw_service id={getattr(s, 'id', 'N/A')} "
f"exp_id={getattr(s, 'experiment_id', 'N/A')} "
f"run_id={getattr(s, 'run_id', 'N/A')}"
)
running_services = [
s
for s in all_services
Expand Down Expand Up @@ -157,6 +163,10 @@ def _on_services_loaded(self, running_services: list) -> None:
state_icon = state_icons.get(state_name, "?")

service_key = f"{exp_id}:{run_id}:{service_id}"
self.log.info(
f"DEBUG: service_key='{service_key}' (exp_id='{exp_id}', "
f"run_id='{run_id}', service_id='{service_id}')"
)
table.add_row(
exp_display,
description or service_id,
Expand Down
Loading