@@ -219,6 +219,16 @@ error will be displayed.
219
219
when constructing `Chunk`s (such as when constructing the return value). The
220
220
device must support `MemPool.CPURAMResource`. When `nothing`, uses
221
221
`MemPool.GLOBAL_DEVICE[]`.
222
+ - `storage_root_tag::Any=nothing`: If not `nothing`,
223
+ specifies the MemPool storage leaf tag to associate with the thunk's result.
224
+ This tag can be used by MemPool's storage devices to manipulate their behavior,
225
+ such as the file name used to store data on disk."
226
+ - `storage_leaf_tag::MemPool.Tag,Nothing}=nothing`: If not `nothing`,
227
+ specifies the MemPool storage leaf tag to associate with the thunk's result.
228
+ This tag can be used by MemPool's storage devices to manipulate their behavior,
229
+ such as the file name used to store data on disk."
230
+ - `storage_retain::Bool=false`: The value of `retain` to pass to
231
+ `MemPool.poolset` when constructing the result `Chunk`.
222
232
"""
223
233
Base. @kwdef struct ThunkOptions
224
234
single:: Union{Int,Nothing} = nothing
@@ -230,6 +240,9 @@ Base.@kwdef struct ThunkOptions
230
240
checkpoint = nothing
231
241
restore = nothing
232
242
storage:: Union{Chunk,Nothing} = nothing
243
+ storage_root_tag = nothing
244
+ storage_leaf_tag:: Union{MemPool.Tag,Nothing} = nothing
245
+ storage_retain:: Bool = false
233
246
end
234
247
235
248
"""
@@ -249,7 +262,10 @@ function Base.merge(sopts::SchedulerOptions, topts::ThunkOptions)
249
262
allow_errors,
250
263
topts. checkpoint,
251
264
topts. restore,
252
- topts. storage)
265
+ topts. storage,
266
+ topts. storage_root_tag,
267
+ topts. storage_leaf_tag,
268
+ topts. storage_retain)
253
269
end
254
270
Base. merge (sopts:: SchedulerOptions , :: Nothing ) =
255
271
ThunkOptions (sopts. single,
@@ -283,6 +299,9 @@ function populate_defaults(opts::ThunkOptions, Tf, Targs)
283
299
maybe_default (:checkpoint ),
284
300
maybe_default (:restore ),
285
301
maybe_default (:storage ),
302
+ maybe_default (:storage_root_tag ),
303
+ maybe_default (:storage_leaf_tag ),
304
+ maybe_default (:storage_retain ),
286
305
)
287
306
end
288
307
@@ -530,9 +549,9 @@ function scheduler_run(ctx, state::ComputeState, d::Thunk, options)
530
549
node = unwrap_weak_checked (state. thunk_dict[thunk_id])
531
550
if metadata != = nothing
532
551
state. worker_time_pressure[pid][proc] = metadata. time_pressure
533
- to_storage = node. options. storage
534
- state. worker_storage_pressure[pid][to_storage] = metadata. storage_pressure
535
- state. worker_storage_capacity[pid][to_storage] = metadata. storage_capacity
552
+ # to_storage = fetch( node.options.storage)
553
+ # state.worker_storage_pressure[pid][to_storage] = metadata.storage_pressure
554
+ # state.worker_storage_capacity[pid][to_storage] = metadata.storage_capacity
536
555
state. worker_loadavg[pid] = metadata. loadavg
537
556
sig = signature (node, state)
538
557
state. signature_time_cost[sig] = (metadata. threadtime + get (state. signature_time_cost, sig, 0 )) ÷ 2
@@ -1546,7 +1565,10 @@ function do_task(to_proc, task_desc)
1546
1565
1547
1566
# Construct result
1548
1567
# TODO : We should cache this locally
1549
- send_result || meta ? res : tochunk (res, to_proc; device, persist, cache= persist ? true : cache)
1568
+ send_result || meta ? res : tochunk (res, to_proc; device, persist, cache= persist ? true : cache,
1569
+ tag= options. storage_root_tag,
1570
+ leaf_tag= something (options. storage_leaf_tag, MemPool. Tag ()),
1571
+ retain= options. storage_retain)
1550
1572
catch ex
1551
1573
bt = catch_backtrace ()
1552
1574
RemoteException (myid (), CapturedException (ex, bt))
0 commit comments