Skip to content

Commit

Permalink
Merge branch 'master' into alex_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Foorth committed Jun 1, 2023
2 parents 08a2bd5 + e45a40a commit 2bb62a0
Show file tree
Hide file tree
Showing 148 changed files with 195 additions and 104,398 deletions.
16 changes: 8 additions & 8 deletions core/libs/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ def get_es_credentials(instance):
es_host = es_host + ':' + es_port + '/es' if es_host else None
es_user = settings.ES_MONIT.get('esUser', None)
es_password = settings.ES_MONIT.get('esPassword', None)

if any(i is None for i in (es_host, es_user, es_password)):
raise Exception('ES cluster credentials was not found in settings')
else:
if hasattr(settings, 'ES_CLUSTER'):
es_host = settings.ES_CLUSTER.get('esHost', None)
es_host = settings.ES_CLUSTER.get('esHost', '')
es_port = settings.ES_CLUSTER.get('esPort', '9200')
es_protocol = settings.ES_CLUSTER.get('esProtocol', 'http')
es_path = settings.ES_CLUSTER.get('esPath', '')
es_host = es_protocol + '://' + es_host + ':' + es_port + es_path if es_host else None
es_user = settings.ES_CLUSTER.get('esUser', None)
es_password = settings.ES_CLUSTER.get('esPassword', None)
es_host = es_protocol + '://' + es_host + ':' + es_port + es_path
es_user = settings.ES_CLUSTER.get('esUser', '')
es_password = settings.ES_CLUSTER.get('esPassword', '')

if any(i is None for i in (es_host, es_user, es_password)):
raise Exception('ES cluster credentials was not found in settings')
else:
return es_host, es_user, es_password
return es_host, es_user, es_password

def create_es_connection(instance='es-atlas', protocol='https', timeout=2000, max_retries=10,
retry_on_timeout=True):
Expand Down
15 changes: 13 additions & 2 deletions core/libs/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,23 @@ def is_debug_mode(job):
:param job: dict
:return: bool
"""
is_debug = False

if ('specialhandling' in job and not job['specialhandling'] is None and 'debug' in job['specialhandling']) or (
'commandtopilot' in job and job['commandtopilot'] is not None and len(job['commandtopilot']) > 0 and job['commandtopilot'] != 'tobekilled'
):
return True
is_debug = True
_logger.debug("Debug mode: active pandaid: {0} specialhandling: {1}".format(job['pandaid'], job['specialhandling']))
else:
return False
if ('specialhandling' in job and 'commandtopilot' in job):
_logger.debug(
"Debug mode: not active pandaid: {0} specialhandling: {1} commandtopilot: {2}".format(
job['pandaid'], job['specialhandling'], job['commandtopilot']))
else:
_logger.debug(
"Debug mode: not possible to determine by current parameters pandaid: {0}".format(
job['pandaid']))
return is_debug


def is_job_active(jobststus):
Expand Down
10 changes: 5 additions & 5 deletions core/panda_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ def kill_task(auth, jeditaskid):
except Exception as ex:
resp = "ERROR killTask: %s" % (ex)
_logger.error(ex)
_logger.debug("Finish task command. jeditaskid: {0}, properErrorCode: {1},, URL: {2}, response: {3}".
format(data['jediTaskID'], data['properErrorCode'], url, resp))
else:
resp = 'Jeditaskid is not defined'
_logger.debug("Finish task command. jeditaskid: {0}, properErrorCode: {1}, URL: {2}, response: {3}".
format(data['jediTaskID'], data['properErrorCode'], url, resp))

return resp


Expand Down Expand Up @@ -96,12 +97,11 @@ def finish_task(auth, jeditaskid, soft=True):
resp = post(url, headers=auth, data=data)
resp = resp.text
except Exception as ex:
resp = "ERROR finishTask: %s" % (ex)
_logger.error(ex)
resp = "ERROR finishTask: %s %s" % (ex, resp.status_code)
else:
resp = 'Jeditaskid is not defined'
_logger.debug("Finish task command. jeditaskid: {0}, properErrorCode: {1}, soft: {2}, URL: {3}, response: {4}".
format(data['jediTaskID'], data['properErrorCode'], data['soft'], url, resp))
format(data['jediTaskID'], data['properErrorCode'], data['soft'], url, resp))
return resp


Expand Down
Loading

0 comments on commit 2bb62a0

Please sign in to comment.