@@ 345-360 (lines=16) @@ | ||
342 | pass |
|
343 | ||
344 | ||
345 | def status(): |
|
346 | status_dict = {} |
|
347 | with os.popen('qstat') as f: |
|
348 | try: |
|
349 | f.readline() # read header |
|
350 | f.readline() # read separator |
|
351 | for line in f: |
|
352 | new_line = re.sub(' +', ' ', line.strip()) |
|
353 | job_id = int(new_line.split(' ')[0]) |
|
354 | state = new_line.split(' ')[4] |
|
355 | ||
356 | status_dict[job_id] = state |
|
357 | except e: |
|
358 | print e |
|
359 | ||
360 | return status_dict |
|
361 | ||
362 | ||
363 | def job_stats(job_id): |
@@ 227-243 (lines=17) @@ | ||
224 | pass |
|
225 | ||
226 | ||
227 | def status(): |
|
228 | status_dict = {} |
|
229 | with os.popen('squeue -u `whoami`') as f: |
|
230 | try: |
|
231 | f.readline() # read header |
|
232 | for line in f: |
|
233 | new_line = re.sub(' +', ' ', line.strip()) |
|
234 | job_id = int(new_line.split(' ')[0]) |
|
235 | state = new_line.split(' ')[4] |
|
236 | if state == 'R': |
|
237 | status_dict[job_id] = 'r' |
|
238 | else: |
|
239 | status_dict[job_id] = state |
|
240 | except Exception as e: |
|
241 | print e |
|
242 | ||
243 | return status_dict |
|
244 | ||
245 | ||
246 | def job_stats(job_id): |
@@ 219-235 (lines=17) @@ | ||
216 | pass |
|
217 | ||
218 | ||
219 | def status(): |
|
220 | status_dict = {} |
|
221 | with os.popen('bjobs -w') as f: |
|
222 | try: |
|
223 | f.readline() # read header |
|
224 | for line in f: |
|
225 | new_line = re.sub(' +', ' ', line.strip()) |
|
226 | job_id = int(new_line.split(' ')[0]) |
|
227 | state = new_line.split(' ')[2] |
|
228 | if state == 'RUN': |
|
229 | status_dict[job_id] = 'r' |
|
230 | else: |
|
231 | status_dict[job_id] = state |
|
232 | except e: |
|
233 | print e |
|
234 | ||
235 | return status_dict |
|
236 | ||
237 | ||
238 | def job_stats(job_id): |