Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bob.io.stream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.io.stream
Commits
3a0adafa
Commit
3a0adafa
authored
3 years ago
by
Vincent POLLET
Browse files
Options
Downloads
Patches
Plain Diff
Implements no_write and must_write for metadata writing
parent
395e5ef0
Branches
Branches containing commit
No related tags found
1 merge request
!22
Draft: Implements metadata handling for bob.io.stream.Stream and bob.io.stream.StreamFile
Pipeline
#59358
canceled
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/io/stream/stream.py
+12
-8
12 additions, 8 deletions
bob/io/stream/stream.py
with
12 additions
and
8 deletions
bob/io/stream/stream.py
+
12
−
8
View file @
3a0adafa
...
...
@@ -116,8 +116,8 @@ class Stream:
self
.
reset
()
# initliaze metadata in set_metadata
self
.
_metadata
=
None
self
.
_metadata_info
=
None
self
.
_metadata
=
MetaData
()
self
.
_metadata_info
=
MetaDataInfo
()
self
.
set_metadata
(
metadata
,
metadata_info
)
def
reset
(
self
):
...
...
@@ -235,7 +235,7 @@ class Stream:
if
key
is
None
:
return
self
.
_metadata
if
self
.
_metadata
is
None
:
if
not
self
.
_metadata
:
raise
ValueError
(
"
Metadata are not set!
"
)
# metadata exists
...
...
@@ -265,6 +265,9 @@ class Stream:
def
write_metadata
(
self
):
"""
Write this stream global (not per-frame) and not herited metadata to the output streamfile.
Special entries in the metadata_info as
"
must_write
"
and
"
no_write
"
change the behavior of this function
to always write, respectively never write, a metadatum, independently of the
"
herited
"
or
"
per_frame
"
values.
.. note::
The per-frame metadata should be written to file use the :meth:`~bob.io.stream.Stream.put` method.
...
...
@@ -277,13 +280,14 @@ class Stream:
if
self
.
sink
is
None
:
raise
ValueError
(
"
This stream is not part of a chain that ends writing in a streamfile.
"
)
# breakpoint()
if
self
.
_metadata
is
not
None
:
if
self
.
_metadata
:
for
metadatum
in
self
.
_metadata
.
values
():
# if not herited and not per-frame
if
not
self
.
_metadata_info
.
has_info_value
(
"
herited
"
,
True
,
metadatum
.
name
)
and
not
self
.
_metadata_info
.
has_info_value
(
"
per_frame
"
,
True
,
metadatum
.
name
):
if
(
not
self
.
_metadata_info
.
has_info_value
(
"
herited
"
,
True
,
metadatum
.
name
)
and
not
self
.
_metadata_info
.
has_info_value
(
"
per_frame
"
,
True
,
metadatum
.
name
)
and
not
self
.
_metadata_info
.
has_info_value
(
"
no_write
"
,
True
,
metadatum
.
name
)
)
or
self
.
_metadata_info
.
has_info_value
(
"
must_write
"
,
True
,
metadatum
.
name
):
self
.
sink
.
write_stream_metadata
(
self
.
name
,
metadatum
)
if
self
.
child
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment