Skip to content

Commit

Permalink
add run ranges and special ledcal
Browse files Browse the repository at this point in the history
  • Loading branch information
cfuselli committed Oct 23, 2024
1 parent 4ac1459 commit 241f055
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions amstrax/auto_processing_new/offline_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ def check_for_production(args):
raise ValueError("Output folder not specified.")


def check_existing_jobs(job_name):
"""
Check if a job with the same name is already running, idle, or held.
"""
try:
result = subprocess.run(['condor_q', '-nobatch'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode != 0:
raise RuntimeError(f"condor_q command failed: {result.stderr}")

for line in result.stdout.splitlines():
if job_name in line and " C " not in line: # Ignore completed jobs
log.error(f"Job with name '{job_name}' is already running, idle, or held.")
raise ValueError(f"Job with name '{job_name}' is already running, idle, or held.")

except Exception as e:
log.error(f"Error while checking existing jobs: {e}")
sys.exit(1)


def get_run_ids_from_args(args):

run_ids = []
Expand Down
1 change: 1 addition & 0 deletions amstrax/auto_processing_new/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(self, args):
self.setup_amstrax()
self.setup_production()
self.run_doc = self.db_utils.get_run_doc(self.run_id)
self.get_run_doc_info()

def setup_amstrax(self):

Expand Down

0 comments on commit 241f055

Please sign in to comment.