Skip to content

Commit

Permalink
just make a single log file
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Aug 15, 2024
1 parent c5bcb7f commit 3b5ad23
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

- `pio logs` now includes the UI logs (if run on leader).
- introduce a new od_reading config,`turn_off_leds_during_reading`, which enables / disables turning off the other LEDS during an OD snapshot. By default, it is set to 1 (enables).
- leader-only Pioreactors also have a `config_hostname.local` file now.
- a new top-level section in experiment profiles, `inputs`, allows you to define variables that can be used in expressions. This is useful if you are copy the same constant over an over again, and want a quick way to change it once. Example:
- leader-only Pioreactors also have a `config_<hostname>.local` file now.
- a new top-level section in experiment profiles, `inputs`, allows you to define parameters that can be used in expressions. This is useful if you are copy the same constant over an over again, and want a quick way to change it once. Example:

```
inputs:
Expand Down
1 change: 1 addition & 0 deletions config.dev.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ database=pioreactor.sqlite

[logging]
log_file=./pioreactor.log
ui_log_file=./pioreactor.log

# See Python's logging module for possible values
#TODO: move this to another section
Expand Down
8 changes: 6 additions & 2 deletions pioreactor/cli/pio.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,17 @@ def logs(n: int) -> None:
"""
log_file = config.config.get("logging", "log_file", fallback="/var/log/pioreactor.log")
ui_log_file = (
config.config.get("logging", "ui_log_file", fallback="/var/log/pioreactorui.log")
config.config.get("logging", "ui_log_file", fallback="/var/log/pioreactor.log")
if am_I_leader()
else ""
)
if log_file == ui_log_file:
log_files = [log_file]
else:
log_files = [log_file, ui_log_file]

with subprocess.Popen(
["tail", "-fqn", str(n), log_file, ui_log_file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
["tail", "-fqn", str(n)] + log_files, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
) as process:
assert process.stdout is not None
for line in process.stdout:
Expand Down
4 changes: 2 additions & 2 deletions pioreactor/cluster_management/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def add_worker(hostname: str, password: str, version: str, model: str) -> None:
r.raise_for_status()
except HTTPErrorStatus:
if r.status_code >= 500:
logger.error("Server error. Could not complete. See UI logs in /var/log/pioreactorui.log")
logger.error("Server error. Could not complete. See UI logs")
else:
logger.error(f"Did not add worker {hostname} to backend.")
raise HTTPException(f"Did not add worker {hostname} to backend.")
Expand All @@ -130,7 +130,7 @@ def remove_worker(hostname: str) -> None:
r.raise_for_status()
except HTTPErrorStatus:
if r.status_code >= 500:
click.echo("Server error. Could not complete. See UI logs in /var/log/pioreactorui.log")
click.echo("Server error. Could not complete. See UI logs.")
else:
click.echo(f"Worker {hostname} not present to be removed. Check hostname.")
click.Abort()
Expand Down

0 comments on commit 3b5ad23

Please sign in to comment.