-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from beckermr/exit
TST add a live test
- Loading branch information
Showing
3 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,3 +55,5 @@ docs/_build/ | |
|
||
# PyBuilder | ||
target/ | ||
|
||
scripts/conda-exec/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import sys | ||
import time | ||
|
||
from concurrent.futures import as_completed | ||
from esutil.pbar import PBar | ||
from mattspy import BNLCondorExecutor | ||
|
||
|
||
def fun(n): | ||
time.sleep(120) | ||
return n | ||
|
||
|
||
def main(): | ||
n_jobs = int(sys.argv[1]) | ||
|
||
with BNLCondorExecutor("bnl", debug=True) as exec: | ||
futs = [ | ||
exec.submit(fun, i) | ||
for i in range(n_jobs) | ||
] | ||
|
||
tot = 0 | ||
for fut in PBar(as_completed(futs), total=len(futs), desc="running jobs"): | ||
try: | ||
tot += fut.result() | ||
except Exception as e: | ||
print(f"failure: {repr(e)}", flush=True) | ||
|
||
assert tot == sum(range(n_jobs)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |