-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05e0521
commit b225e21
Showing
2 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
from htcondor_es.utils import ( | ||
get_schedds, | ||
collect_metadata, | ||
send_email_alert, | ||
TIMEOUT_MINS, | ||
) | ||
from htcondor_es.amq import post_ads | ||
|
@@ -55,6 +56,7 @@ | |
acks_late=True, # Only ack the message when done | ||
retry_backoff=5, # Wait between retries (5, 10,15)s | ||
reject_on_worker_lost=True, # If the worker is killed (e.g. by k8s) reasign the task | ||
on_failure=log_failure, | ||
) | ||
def query_schedd( | ||
schedd_ad, | ||
|
@@ -223,6 +225,16 @@ def create_affiliation_dir(days=1): | |
pass | ||
|
||
|
||
def log_failure(self, exc, task_id, args, kwargs, einfo): | ||
"""Send email message and log error. | ||
(this only should be send if all retries failed) | ||
""" | ||
message = f"failed to query {args}, {kwargs}" | ||
logging.error(f"failed to query {args}, {kwargs}") | ||
# TODO: Change email with parameters | ||
send_email_alert("[email protected]", "[Spider] Failed to query", message) | ||
|
||
|
||
# ---Utils--- | ||
def grouper(iterable, n, fillvalue=None): | ||
"""Collect data into fixed-length chunks or blocks | ||
|