Skip to content

Commit

Permalink
fallback on local execution if slurm fails
Browse files Browse the repository at this point in the history
  • Loading branch information
tmichela committed Aug 30, 2024
1 parent c295f8d commit 2f8d2a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion damnit/backend/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import platform
from pathlib import Path
from socket import gethostname
from threading import Thread

from kafka import KafkaConsumer

Expand Down Expand Up @@ -110,7 +111,11 @@ def handle_event(self, record, msg: dict, run_data: RunData):
log.info(f"Added p%d r%d ({run_data.value} data) to database", proposal, run)

req = ExtractionRequest(run, proposal, run_data)
self.submitter.submit(req)
try:
self.submitter.submit(req)
except Exception:
log.warning("Slurm job submission failed, starting process locally")
Thread(target=self.submitter.execute_direct, args=(req, )).start()

Check warning on line 118 in damnit/backend/listener.py

View check run for this annotation

Codecov / codecov/patch

damnit/backend/listener.py#L114-L118

Added lines #L114 - L118 were not covered by tests


def listen():
Expand Down

0 comments on commit 2f8d2a2

Please sign in to comment.