9393function fill_registered_futures! (state, thunk, failed)
9494 if haskey (state. futures, thunk)
9595 # Notify any listening thunks
96+ @dagdebug thunk :finish " Notifying $(length (state. futures[thunk])) futures"
9697 for future in state. futures[thunk]
9798 put! (future, load_result (state, thunk); error= failed)
9899 end
@@ -135,14 +136,20 @@ end
135136
136137" Schedules any dependents that may be ready to execute."
137138function schedule_dependents! (state, thunk, failed)
139+ @dagdebug thunk :finish " Checking dependents"
138140 if ! haskey (state. waiting_data, thunk) || isempty (state. waiting_data[thunk])
139141 return
140142 end
143+ ctr = 0
141144 for dep in state. waiting_data[thunk]
145+ @dagdebug dep :schedule " Checking dependent"
142146 dep_isready = false
143147 if haskey (state. waiting, dep)
144148 set = state. waiting[dep]
145149 thunk in set && pop! (set, thunk)
150+ if length (set) > 0
151+ @dagdebug dep :schedule " Dependent has $(length (set)) upstreams"
152+ end
146153 dep_isready = isempty (set)
147154 if dep_isready
148155 delete! (state. waiting, dep)
@@ -151,11 +158,17 @@ function schedule_dependents!(state, thunk, failed)
151158 dep_isready = true
152159 end
153160 if dep_isready
161+ ctr += 1
154162 if ! failed
155163 push! (state. ready, dep)
164+ @dagdebug dep :schedule " Dependent is now ready"
165+ else
166+ set_failed! (state, thunk, dep)
167+ @dagdebug dep :schedule " Dependent has transitively failed"
156168 end
157169 end
158170 end
171+ @dagdebug thunk :finish " Marked $ctr dependents as $(failed ? " failed" : " ready" ) "
159172end
160173
161174"""
@@ -226,6 +239,8 @@ const RESCHEDULE_SYNCDEPS_SEEN_CACHE = TaskLocalValue{ReusableCache{Set{Thunk},N
226239" Marks `thunk` and all dependent thunks as failed."
227240function set_failed! (state, origin, thunk= origin)
228241 @assert islocked (state. lock)
242+ has_result (state, thunk) && return
243+ @dagdebug thunk :finish " Setting as failed"
229244 filter! (x -> x != = thunk, state. ready)
230245 # N.B. If origin === thunk, we assume that the caller has already set the error
231246 if origin != = thunk
554569 end
555570 end
556571
572+ # Estimate total cost for executing this task on each candidate processor
557573 for proc in procs
558574 gproc = get_parent (proc)
559575 chunks_filt = Iterators. filter (c-> get_parent (processor (c)) != gproc, chunks)
0 commit comments