| @@ 225-241 (lines=17) @@ | ||
| 222 | pass |
|
| 223 | ||
| 224 | ||
| 225 | def status(): |
|
| 226 | status_dict = {} |
|
| 227 | with os.popen('squeue -u `whoami`') as f: |
|
| 228 | try: |
|
| 229 | f.readline() # read header |
|
| 230 | for line in f: |
|
| 231 | new_line = re.sub(' +', ' ', line.strip()) |
|
| 232 | job_id = int(new_line.split(' ')[0]) |
|
| 233 | state = new_line.split(' ')[4] |
|
| 234 | if state == 'R': |
|
| 235 | status_dict[job_id] = 'r' |
|
| 236 | else: |
|
| 237 | status_dict[job_id] = state |
|
| 238 | except Exception as e: |
|
| 239 | print(e) |
|
| 240 | ||
| 241 | return status_dict |
|
| 242 | ||
| 243 | ||
| 244 | def job_stats(job_id): |
|
| @@ 209-225 (lines=17) @@ | ||
| 206 | pass |
|
| 207 | ||
| 208 | ||
| 209 | def status(): |
|
| 210 | status_dict = {} |
|
| 211 | with os.popen('bjobs -w') as f: |
|
| 212 | try: |
|
| 213 | f.readline() # read header |
|
| 214 | for line in f: |
|
| 215 | new_line = re.sub(' +',' ',line.strip()) |
|
| 216 | job_id = int(new_line.split(' ')[0]) |
|
| 217 | state = new_line.split(' ')[2] |
|
| 218 | if state == 'RUN': |
|
| 219 | status_dict[job_id] = 'r' |
|
| 220 | else: |
|
| 221 | status_dict[job_id] = state |
|
| 222 | except e: |
|
| 223 | print(e) |
|
| 224 | ||
| 225 | return status_dict |
|
| 226 | ||
| 227 | ||
| 228 | def job_stats(job_id): |
|
| @@ 320-335 (lines=16) @@ | ||
| 317 | with os.popen('qdel '+job_id) as f: |
|
| 318 | pass |
|
| 319 | ||
| 320 | def status(): |
|
| 321 | status_dict = {} |
|
| 322 | with os.popen('qstat') as f: |
|
| 323 | try: |
|
| 324 | f.readline() # read header |
|
| 325 | f.readline() # read separator |
|
| 326 | for line in f: |
|
| 327 | new_line = re.sub(' +',' ',line.strip()) |
|
| 328 | job_id = int(new_line.split(' ')[0]) |
|
| 329 | state = new_line.split(' ')[4] |
|
| 330 | ||
| 331 | status_dict[job_id] = state |
|
| 332 | except e: |
|
| 333 | print(e) |
|
| 334 | ||
| 335 | return status_dict |
|
| 336 | ||
| 337 | def job_stats(job_id): |
|
| 338 | stats_dict = {} |
|