From 0b282b00200e365d37b5029a106cc26ddc600f44 Mon Sep 17 00:00:00 2001 From: Christian Ariza Date: Thu, 11 Jun 2020 20:19:21 +0200 Subject: [PATCH] [ConvertToJson] bugfix GLIDEIN Memory --- src/htcondor_es/convert_to_json.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/htcondor_es/convert_to_json.py b/src/htcondor_es/convert_to_json.py index a56bdeb..6cd4c28 100644 --- a/src/htcondor_es/convert_to_json.py +++ b/src/htcondor_es/convert_to_json.py @@ -1336,6 +1336,9 @@ def bulk_convert_ad_data(ad, result): elif key in bool_vals: value = bool(value) elif key in int_vals: + if repr(value) == "'GLIDEIN_MaxMemMBs'": + _glidein_maxmem = ad.get("GLIDEIN_MaxMemMBs", None) + value = int(_glidein_maxmem) if _glidein_maxmem is not None else None try: value = int(value) except ValueError: @@ -1356,18 +1359,10 @@ def bulk_convert_ad_data(ad, result): try: value = int(value) except ValueError: - if repr(value) == "'GLIDEIN_MaxMemMBs'": - _glidein_maxmem = ad.get("GLIDEIN_MaxMemMBs", None) - value = ( - int(_glidein_maxmem) - if _glidein_maxmem is not None - else None - ) - else: - logging.warning( - "Failed to convert key %s with value %s to int for a date field" - % (key, repr(value)) - ) + logging.warning( + "Failed to convert key %s with value %s to int for a date field" + % (key, repr(value)) + ) value = None # elif key in date_vals: # value = datetime.datetime.fromtimestamp(value).strftime("%Y-%m-%d %H:%M:%S")