update testing script: only check task state of clusrun job

This commit is contained in:
zclok010 2019-01-29 22:08:29 +08:00
Родитель cd751b1299
Коммит b5497bed04
1 изменённых файлов: 15 добавлений и 14 удалений

Просмотреть файл

@ -199,22 +199,23 @@ def main(cluster, category, command, result, name, cancel, timeout, timeoutToCle
response = restGet(api)
if response:
tasks = response.json()
if category == 'clusrun' and len(tasks) != len(selectedNodes):
print('[Fail]: tasks count {0} is not correct, expecting {1}.'.format(len(tasks), validateTaskCount))
return 'Fail'
nodes = set(selectedNodes)
for task in tasks:
taskId = task["id"]
taskState = task['state']
if taskState == 'Canceled':
print('[Warn]: task {0} state is {1}.'.format(taskId, taskState))
return 'Warn'
if taskState != 'Finished' and taskState != 'Failed':
print('[Fail]: task {0} state {1} is not correct.'.format(taskId, taskState))
return 'Fail'
if task['node'] not in nodes:
print('[Fail]: node {0} of task {1} is not in allocated nodes list.'.format(task['node'], taskId))
if category == 'clusrun':
if len(tasks) != len(selectedNodes):
print('[Fail]: tasks count {0} is not correct, expecting {1}.'.format(len(tasks), validateTaskCount))
return 'Fail'
for task in tasks:
taskId = task["id"]
taskState = task['state']
if taskState == 'Canceled':
print('[Warn]: task {0} state is {1}.'.format(taskId, taskState))
return 'Warn'
if taskState != 'Finished' and taskState != 'Failed':
print('[Fail]: task {0} state {1} is not correct.'.format(taskId, taskState))
return 'Fail'
if task['node'] not in nodes:
print('[Fail]: node {0} of task {1} is not in allocated nodes list.'.format(task['node'], taskId))
return 'Fail'
else:
print('Get {}: {}'.format(api, response))
print('[Fail]: failed to get task info of job.')