Skip to content

Commit

Permalink
Add username to processing status info
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Aug 30, 2024
1 parent 542fd68 commit 8c53ab1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions damnit/backend/extract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import socket
import subprocess
import sys
from getpass import getuser
from pathlib import Path
from tempfile import TemporaryDirectory
from uuid import uuid4
Expand Down Expand Up @@ -186,6 +187,7 @@ def __init__(self, proposal, run, cluster=False, run_data=RunData.ALL,
'run': run,
'data': run_data.value,
'hostname': socket.gethostname(),
'username': getuser(),
'slurm_cluster': self._slurm_cluster(),
'slurm_job_id': os.environ.get('SLURM_JOB_ID', ''),
})
Expand Down
2 changes: 1 addition & 1 deletion damnit/gui/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def update_processing_status(self, proposal, run):
runnr_item.setData(f"{run} ⚙️", Qt.ItemDataRole.DisplayRole)
if len(jobs_for_run) == 1:
info = jobs_for_run[0]
msg = f"Processing on {info['hostname']}"
msg = f"Processing on {info['username']}@{info['hostname']}"
if job_id := info['slurm_job_id']:
msg += f" (Slurm job {job_id})"

Check warning on line 670 in damnit/gui/table.py

View check run for this annotation

Codecov / codecov/patch

damnit/gui/table.py#L670

Added line #L670 was not covered by tests
runnr_item.setToolTip(msg)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,8 @@ def shows_as_processing(run):
runnr_s = tbl.item(row, 2).data(Qt.ItemDataRole.DisplayRole)
return "⚙️" in runnr_s

d = {'proposal': 1234, 'data': 'all', 'hostname': '', 'slurm_cluster': '', 'slurm_job_id': ''}
d = {'proposal': 1234, 'data': 'all', 'hostname': '', 'username': '',
'slurm_cluster': '', 'slurm_job_id': ''}

# Test with an existing run
prid1, prid2 = str(uuid4()), str(uuid4())
Expand Down

0 comments on commit 8c53ab1

Please sign in to comment.