blob: 863375c4e385109767bbb2467984be7dd9e8f5f6 [file] [log] [blame]
Scott Zawalskicb2e2b72012-04-17 12:10:05 -04001#!/usr/bin/python
2
3import sys
4import common
5from autotest_lib.server import frontend
6
7_AFE = frontend.AFE(debug=False)
8
9def is_job_complete(job_id):
10 """
11 Check if a job is no longer active.
12
13 @param job_id: afe job id like 123 from 123-scottz
14 @return True if job is complete and False if it is not
15 """
16 if not _AFE.run('get_jobs', finished=True, id=job_id):
17 return 1
18
19 return 0
20
21if __name__ == '__main__':
22 if len(sys.argv) != 2:
23 print ('Set return status to 0 if job is complete or 1 if it is not.\n'
24 'Usage: is_job_complete.py <job_id>')
25 else:
26 sys.exit(is_job_complete(sys.argv[1]))