Skip to content

Commit

Permalink
Merge pull request #348 from European-XFEL/job-logging
Browse files Browse the repository at this point in the history
Always log the username and hostname in a processing job
  • Loading branch information
JamesWrigley authored Oct 18, 2024
2 parents e2677b0 + 1c633c2 commit be6ed9d
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)
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",
os.environ.get('SLURM_JOB_ID', '?'))

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

0 comments on commit be6ed9d

Please sign in to comment.