Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
scdaq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
scouting-demonstrator
scdaq
Commits
e2a1b600
Commit
e2a1b600
authored
1 month ago
by
Giovanna Lazzari Miotto
Browse files
Options
Downloads
Patches
Plain Diff
tidy: output,sink: Pass args as const references
parent
5eaf4c3d
No related branches found
Branches containing commit
No related tags found
1 merge request
!109
Introduce pipeline synchronization, output template and parallel sink
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/OutputFile.cc
+1
-1
1 addition, 1 deletion
src/OutputFile.cc
src/OutputFile.h
+10
-9
10 additions, 9 deletions
src/OutputFile.h
src/OutputFileHandler.cc
+1
-0
1 addition, 0 deletions
src/OutputFileHandler.cc
src/sink.cc
+2
-2
2 additions, 2 deletions
src/sink.cc
src/sink.h
+4
-3
4 additions, 3 deletions
src/sink.h
with
18 additions
and
15 deletions
src/OutputFile.cc
+
1
−
1
View file @
e2a1b600
...
...
@@ -49,7 +49,7 @@ std::string Detail::LumisectionMetadata::MakeFooter(uint32_t run_number) const {
return
footer
.
str
();
}
void
Detail
::
RunMetadata
::
AddLumisectionMetadata
(
LumisectionMetadata
&
ls
)
{
void
Detail
::
RunMetadata
::
AddLumisectionMetadata
(
const
LumisectionMetadata
&
ls
)
{
std
::
lock_guard
<
std
::
mutex
>
l
(
mutex_
);
num_orbits
+=
ls
.
num_orbits
;
num_files
+=
ls
.
num_files
;
...
...
This diff is collapsed.
Click to expand it.
src/OutputFile.h
+
10
−
9
View file @
e2a1b600
...
...
@@ -92,7 +92,7 @@ struct RunMetadata {
num_orbits
=
num_files
=
0
;
number
=
run_number
;
}
void
AddLumisectionMetadata
(
LumisectionMetadata
&
ls
);
void
AddLumisectionMetadata
(
const
LumisectionMetadata
&
ls
);
std
::
string
MakeFooter
(
uint32_t
ls_index
)
const
;
};
...
...
@@ -110,23 +110,23 @@ class Output {
Output
()
=
default
;
~
Output
()
{}
auto
GetHandle
()
const
{
return
handle_
;
}
[[
maybe_unused
]]
auto
GetHandle
()
const
{
return
handle_
;
}
auto
GetMetadata
()
const
{
return
md_
;
}
auto
GetLumisection
()
const
{
return
md_
.
lumisection
;
}
auto
GetLumisectionFooter
()
const
{
return
ls_footer_
;
}
[[
maybe_unused
]]
auto
GetLumisection
()
const
{
return
md_
.
lumisection
;
}
[[
maybe_unused
]]
auto
GetLumisectionFooter
()
const
{
return
ls_footer_
;
}
auto
HasPayload
()
const
{
auto
min_val
=
header_
.
has_value
()
?
sizeof
(
HeaderType
)
:
0
;
return
md_
.
size
>
min_val
;
}
auto
HasLumisectionFooter
()
const
{
return
ls_footer_
.
lumisection
!=
0
;
}
[[
maybe_unused
]]
auto
HasLumisectionFooter
()
const
{
return
ls_footer_
.
lumisection
!=
0
;
}
auto
HasHeader
()
const
{
return
reserved_header_
;
};
auto
GetHeader
()
const
->
std
::
optional
<
HeaderType
>
{
return
header_
;
}
[[
maybe_unused
]]
auto
GetHeader
()
const
->
std
::
optional
<
HeaderType
>
{
return
header_
;
}
void
UpdateHeader
()
{
header_
=
HeaderType
(
md_
.
source_id
,
md_
.
num_orbits
,
md_
.
run_number
,
md_
.
lumisection
,
md_
.
size
);
}
void
SetLumisectionFooter
(
Detail
::
LumisectionMetadata
ls
)
{
void
SetLumisectionFooter
(
const
Detail
::
LumisectionMetadata
&
ls
)
{
// The last file in a lumisection carries an LS metadata footer
ls_footer_
=
ls
;
}
...
...
@@ -136,14 +136,15 @@ class Output {
virtual
bool
Open
()
=
0
;
virtual
int
Write
(
const
char
*&
buffer
,
size_t
size_bytes
,
uint32_t
size_orbits
)
=
0
;
[[
maybe_unused
]]
virtual
int
WriteAt
(
const
char
*&
data
,
size_t
size_bytes
,
std
::
optional
<
off_t
>
abs_seek
)
=
0
;
[[
maybe_unused
]]
virtual
int
WriteAt
(
const
char
*&
data
,
size_t
size_bytes
,
std
::
optional
<
off_t
>
abs_seek
)
=
0
;
virtual
bool
Close
()
=
0
;
virtual
bool
IsOpen
()
const
=
0
;
protected
:
OutputHandleType
handle_
;
std
::
optional
<
HeaderType
>
header_
;
Detail
::
FileMetadata
md_
;
Detail
::
FileMetadata
md_
{}
;
Detail
::
LumisectionMetadata
ls_footer_
{};
bool
reserved_header_
{
false
};
...
...
This diff is collapsed.
Click to expand it.
src/OutputFileHandler.cc
+
1
−
0
View file @
e2a1b600
...
...
@@ -50,6 +50,7 @@ void OutputFileHandler::UpdateRunInfo(uint32_t next_run, uint32_t next_index) {
}
void
OutputFileHandler
::
CommitFile
()
{
assert
(
ls_
);
ls_
->
AddFileMetadata
(
outputFile_
.
GetMetadata
());
Detail
::
FileMetadata
file_meta
=
outputFile_
.
GetMetadata
();
if
(
ls_
->
IsLastIndex
(
file_meta
.
index_in_ls
)
&&
IsMainPipeline
()
&&
HasCmsswHeaders
())
{
...
...
This diff is collapsed.
Click to expand it.
src/sink.cc
+
2
−
2
View file @
e2a1b600
...
...
@@ -26,9 +26,9 @@ void Sink<TOutput>::CommitFileHeader(TOutput &file) {
}
template
<
typename
TOutput
>
void
Sink
<
TOutput
>::
CommitOutput
(
TOutput
&
f
)
{
void
Sink
<
TOutput
>::
CommitOutput
(
const
TOutput
&
f
)
{
if
constexpr
(
std
::
is_same
<
TOutput
,
FileOutput
>
())
{
auto
file
=
reinterpret_cast
<
FileOutput
&>
(
f
);
auto
file
=
reinterpret_cast
<
const
FileOutput
&>
(
f
);
auto
filename
=
file
.
GetFilename
();
LOG
(
TRACE
)
<<
"Closing file '"
<<
filename
<<
"'"
;
assert
(
file
.
Close
());
...
...
This diff is collapsed.
Click to expand it.
src/sink.h
+
4
−
3
View file @
e2a1b600
...
...
@@ -50,10 +50,11 @@ class Sink {
}
}
}
void
CommitOutput
(
TOutput
&
f
);
void
CommitOutput
(
const
TOutput
&
f
);
// CommitFileHeader: updates header
void
CommitFileHeader
(
TOutput
&
f
);
Sink
(
std
::
string
rp
,
std
::
string
mp
)
:
root_path_
(
rp
),
metadata_path_
(
mp
)
{
Sink
(
const
std
::
string
&
rp
,
const
std
::
string
&
mp
)
:
root_path_
(
rp
),
metadata_path_
(
mp
)
{
commit_thread_
=
std
::
thread
(
&
Sink
::
ProcessQueue
,
this
);
}
...
...
@@ -65,7 +66,7 @@ class Sink {
commit_thread_
.
join
();
}
void
WriteLumisectionFooter
(
uint32_t
run_number
,
Detail
::
LumisectionMetadata
&
ls
)
{
void
WriteLumisectionFooter
(
uint32_t
run_number
,
const
Detail
::
LumisectionMetadata
&
ls
)
{
auto
footer
=
ls
.
MakeFooter
(
run_number
);
auto
filename
=
Detail
::
FormatRun
(
run_number
)
+
"_"
+
...
...
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