Mercurial > repos > peterjc > tmhmm_and_signalp
comparison tools/protein_analysis/seq_analysis_utils.py @ 6:a290c6d4e658
Migrated tool version 0.0.9 from old tool shed archive to new tool shed repository
| author | peterjc |
|---|---|
| date | Tue, 07 Jun 2011 18:07:09 -0400 |
| parents | f3b373a41f81 |
| children | 9b45a8743100 |
comparison
equal
deleted
inserted
replaced
| 5:0f1c61998b22 | 6:a290c6d4e658 |
|---|---|
| 100 if os.path.isfile(f): | 100 if os.path.isfile(f): |
| 101 os.remove(f) | 101 os.remove(f) |
| 102 raise err | 102 raise err |
| 103 return files | 103 return files |
| 104 | 104 |
| 105 def run_jobs(jobs, threads, verbose=False): | 105 def run_jobs(jobs, threads, pause=10, verbose=False): |
| 106 """Takes list of cmd strings, returns dict with error levels.""" | 106 """Takes list of cmd strings, returns dict with error levels.""" |
| 107 pending = jobs[:] | 107 pending = jobs[:] |
| 108 running = [] | 108 running = [] |
| 109 results = {} | 109 results = {} |
| 110 while pending or running: | 110 while pending or running: |
| 124 if verbose: | 124 if verbose: |
| 125 print cmd | 125 print cmd |
| 126 process = subprocess.Popen(cmd, shell=True) | 126 process = subprocess.Popen(cmd, shell=True) |
| 127 running.append((cmd, process)) | 127 running.append((cmd, process)) |
| 128 #Loop... | 128 #Loop... |
| 129 sleep(10) | 129 sleep(pause) |
| 130 if verbose: | 130 if verbose: |
| 131 print "%i jobs completed" % len(results) | 131 print "%i jobs completed" % len(results) |
| 132 assert set(jobs) == set(results) | 132 assert set(jobs) == set(results) |
| 133 return results | 133 return results |
