Skip to content

Commit

Permalink
Always log the username and hostname in a processing job
Browse files Browse the repository at this point in the history
This can be helpful when debugging.
  • Loading branch information
JamesWrigley committed Oct 18, 2024
1 parent e2677b0 commit 1c633c2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions damnit/backend/extract_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
import argparse
import copy
import getpass
import os
import logging
import pickle
Expand Down Expand Up @@ -265,13 +266,15 @@ def main(argv=None):
# Hide some logging from Kafka to make things more readable
logging.getLogger('kafka').setLevel(logging.WARNING)

print(f"\n----- Processing r{args.run} (p{args.proposal}) -----", file=sys.stderr)
username = getpass.getuser()
hostname = socket.gethostname()
print(f"\n----- Processing r{args.run} (p{args.proposal}) as {username} on {hostname} -----", file=sys.stderr)

Check warning on line 271 in damnit/backend/extract_data.py

View check run for this annotation

Codecov / codecov/patch

damnit/backend/extract_data.py#L269-L271

Added lines #L269 - L271 were not covered by tests
log.info(f"run_data={args.run_data}, match={args.match}")
if args.mock:
log.info("Using mock run object for testing")
if args.cluster_job:
log.info("Extracting cluster variables in Slurm job %s on %s",
os.environ.get('SLURM_JOB_ID', '?'), socket.gethostname())
log.info("Extracting cluster variables in Slurm job %s",

Check warning on line 276 in damnit/backend/extract_data.py

View check run for this annotation

Codecov / codecov/patch

damnit/backend/extract_data.py#L276

Added line #L276 was not covered by tests
os.environ.get('SLURM_JOB_ID', '?'))

extr = Extractor()
if args.update_vars:
Expand Down

0 comments on commit 1c633c2

Please sign in to comment.