Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/alex_dev' into alex_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Foorth committed Jun 1, 2023
2 parents 3f856cc + 9bbd5d8 commit 08a2bd5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
12 changes: 8 additions & 4 deletions core/panda_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ def kill_task(auth, jeditaskid):
resp = post(url, headers=auth, data=data)
resp = resp.text
except Exception as ex:
resp = "ERROR killTask: %s %s" % (ex, resp.status_code)
resp = "ERROR killTask: %s" % (ex)
_logger.error(ex)
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 @@ -94,10 +96,12 @@ 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 %s" % (ex, resp.status_code)
resp = "ERROR finishTask: %s" % (ex)
_logger.error(ex)
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))
return resp


Expand Down
21 changes: 16 additions & 5 deletions core/panda_client/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@ def client(request):
if auth is not None and ('Authorization' in auth and 'Origin' in auth):
if len(request.session['requestParams']) > 0:
data = request.session['requestParams']

if 'taskID' in data and data['taskID'] is not None:
jeditaskid = data['taskID']
elif 'taskid' in data and data['taskid'] is not None:
jeditaskid = data['taskid']
else:
jeditaskid = None

###Finish Task
if data['action'] == 'finishtask' and ('taskID' in data and data['taskID'] is not None):
info['text'] = finish_task(auth=auth, jeditaskid=data['taskID'])
if data['action'] == 'finishtask' and jeditaskid is not None:
info['text'] = finish_task(auth=auth, jeditaskid=jeditaskid)
### Kill Task
elif data['action'] == 'killtask' and ('taskID' in data and data['taskID'] is not None):
info['text'] = kill_task(auth=auth, jeditaskid=data['taskID'])
elif data['action'] == 'killtask' and jeditaskid is not None:
info['text'] = kill_task(auth=auth, jeditaskid=jeditaskid)
### Set debug mode
elif data['action'] == 'setdebugmode' and ('pandaid' in data and data['pandaid'] is not None):
if ('params' in data and data['params'] is not None):
Expand All @@ -44,7 +52,10 @@ def client(request):
else:
info['redirect'] = 'false'
else:
info['text'] = 'Operation error'
if jeditaskid is None:
info['text'] = 'Error! JeditaskID is none'
else:
info['text'] = 'Operation error'
else:
info['text'] = 'Request body is empty'
else:
Expand Down

0 comments on commit 08a2bd5

Please sign in to comment.