Last active
August 29, 2015 14:10
-
-
Save cfriedline/811d54ce12aad41e37d7 to your computer and use it in GitHub Desktop.
ipython engine active
This file contains hidden or 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
#run this look, manually filling in exclude when it hangs | |
exclude = set([636, 640, 648, 741]) | |
for x in xrange(len(rc)): | |
if not x in exclude: | |
print x, rc[x].apply(os.getpid).r | |
#given the manual exclude from above, redefine dview and lview based on active targets | |
exclude = set([636, 640, 648, 741]) | |
active = [] | |
for i in xrange(len(rc)): | |
if i not in exclude: | |
active.append(i) | |
dview = rc[active] | |
lview = rc.load_balanced_view(targets=active) | |
#This is better: | |
for x in xrange(len(rc)): | |
with stopit.ThreadingTimeout(5) as to_ctx_mgr: | |
try: | |
print x, rc[x].apply(os.getpid).r | |
except: | |
exclude.add(x) | |
#from @minrk | |
qs = rc.queue_status() | |
not_idle = [ eid for eid in qs if qs[eid]['queue'] or qs[eid]['tasks'] ] | |
#or (via the gitter), my idea to account for 'unassigned' | |
qs = rc.queue_status() | |
not_idle = [eid for eid in sorted(qs)[:-1] if qs[eid]['queue'] and qs[eid]['tasks’]] | |
#also this would be easier to plug into rc[] and lview targets: | |
qs = rc.queue_status() | |
idle = [eid for eid in sorted(qs)[:-1] if not qs[eid]['queue'] and not qs[eid]['tasks']] | |
dview = rc[idle] | |
lview = rc.load_balanced_view(targets=idle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment