Skip to content

Commit 2b2eb4a

Browse files
committed
move partial
1 parent 6dbe801 commit 2b2eb4a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/episodes.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ mutable struct EpisodesBuffer{names, E, T<:AbstractTraces{names, E},B,S} <: Abst
2828
episodes_lengths::B
2929
end
3030

31+
"""
32+
PartialNamedTuple(::NamedTuple)
33+
34+
Wraps a NamedTuple to signal an EpisodesBuffer that it is pushed into that it should
35+
ignore the fact that this is a partial insertion. Used at the end of an episode to
36+
complete multiplex traces before moving to the next episode.
37+
"""
38+
struct PartialNamedTuple{T}
39+
namedtuple::T
40+
end
41+
3142
function EpisodesBuffer(traces::AbstractTraces)
3243
cap = any(t->t isa MultiplexTraces, traces.traces) ? capacity(traces) + 1 : capacity(traces)
3344
@assert isempty(traces) "EpisodesBuffer must be initialized with empty traces."
@@ -105,10 +116,6 @@ function Base.push!(eb::EpisodesBuffer, xs::PartialNamedTuple) #wrap a NamedTupl
105116
push!(eb.traces, xs.namedtuple)
106117
end
107118

108-
struct PartialNamedTuple{T}
109-
namedtuple::T
110-
end
111-
112119
#= currently unsupported due to lack of support of appending a named tuple to traces with multiplextraces.
113120
for f in (:append!,) #append! assumes that complete episodes coming from distributed agents will be appended.
114121
@eval function Base.$f(es::EpisodesBuffer, xs::EpisodesBuffer)

0 commit comments

Comments
 (0)