Skip to content
Closed
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
9 changes: 8 additions & 1 deletion src/drunc/process_manager/interface/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,22 @@ def logs(
obj: ProcessManagerContext, how_far: int, grep: str, query: ProcessQuery
) -> None:
log = get_logger("process_manager.shell")
log.debug(f"Running logs with query {query}")
log.critical(f"Running logs with query {query}")
log_req = LogRequest(
how_far=how_far,
query=query,
)
log.critical(f"We are at the log request {log_req}")

result = obj.get_driver("process_manager").logs(log_req)

log.critical("thingy1")

if result.uuid.uuid is not None:
obj.rule(f"[yellow]{result.uuid.uuid}[/yellow] logs")

log.critical("thingy2")

for line in result.lines:
if not line.strip(): # keep empty lines for visual clarity
obj.print("")
Expand All @@ -234,7 +239,9 @@ def logs(
line = line.replace(grep, f"[u]{grep}[/]")

obj.print(line)
log.critical("thingy3")
obj.rule("End")
log.critical("thingy4")


@click.command("restart")
Expand Down
4 changes: 2 additions & 2 deletions src/drunc/process_manager/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def logs(self, request: LogRequest, context: ServicerContext) -> LogLines:
Returns:
A response containing log lines.
"""
self.log.debug("Getting logs")
self.log.critical("Getting logs")

try:
response = self._logs_impl(request)
Expand Down Expand Up @@ -498,7 +498,7 @@ def _ensure_one_process(
else:
if uuids[0] not in self.process_store:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the case for looking in the process_store?

raise BadQuery(
f"Couldn't find the process corresponding to the UUID {uuids[0]} in the process store"
f"Couldn't find the process corresponding to the UUID {uuids[0]} in the process store. Process store {self.process_store}"
)
return uuids[0]

Expand Down
4 changes: 3 additions & 1 deletion src/drunc/process_manager/ssh_process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ def _logs_impl(self, log_request: LogRequest) -> LogLines:
)

# Ensure exactly one process matches the query
uid = self._ensure_one_process(matching_uuids)
uid = self._ensure_one_process(matching_uuids, in_boot_request=True)
#! Thank you copilot. now why does this work??
# Better yet, better understand why it has to be in boot request true here..
Comment on lines +227 to +229
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this work?


# Extract log file location and connection details from boot request
logfile = self.boot_request[uid].process_description.process_logs_path
Expand Down
Loading