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
a7fdceca
Commit
a7fdceca
authored
6 months ago
by
Giovanna Lazzari Miotto
Browse files
Options
Downloads
Patches
Plain Diff
ref: output: Resolve lumi index through method
parent
9d4b45f7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!109
Introduce pipeline synchronization, output template and parallel sink
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OutputFileHandler.cc
+26
-10
26 additions, 10 deletions
src/OutputFileHandler.cc
src/OutputFileHandler.h
+4
-2
4 additions, 2 deletions
src/OutputFileHandler.h
with
30 additions
and
12 deletions
src/OutputFileHandler.cc
+
26
−
10
View file @
a7fdceca
#include
"OutputFileHandler.h"
#include
<stdint.h>
#include
<atomic>
#include
<cassert>
#include
<string>
...
...
@@ -15,6 +17,22 @@ std::string OutputFileHandler::GetSinkDataDir() const {
return
Detail
::
FormatRun
(
run_
.
number
)
+
"/"
;
}
uint32_t
OutputFileHandler
::
GetMaxFileIndexPerLumisection
()
{
auto
max_index
=
static_cast
<
uint32_t
>
(
constants
::
N_orbits_per_lumisection
/
nOrbitsPerFile_
)
-
1
;
if
(
HasCmsswHeaders
())
{
return
10
;
}
else
{
return
UINT32_MAX
;
}
}
uint32_t
OutputFileHandler
::
GetLumisectionFromFileIndex
(
int
index
)
{
assert
(
index
>
0
&&
nOrbitsPerFile_
>
0
);
uint32_t
i
=
index
;
auto
ls_index
=
1
+
(
i
*
nOrbitsPerFile_
)
/
constants
::
N_orbits_per_lumisection
;
return
1
+
i
/
10
;
}
void
OutputFileHandler
::
UpdateRunInfo
(
uint32_t
run
,
uint32_t
index
)
{
if
(
run_
.
number
!=
static_cast
<
int
>
(
run
))
{
LOG
(
TRACE
)
<<
"Previous run: "
<<
run_
.
number
<<
" | New run: "
<<
run
;
...
...
@@ -27,12 +45,12 @@ void OutputFileHandler::UpdateRunInfo(uint32_t run, uint32_t index) {
current_index_
=
static_cast
<
int
>
(
index
);
}
// 1706770016 //+ 96
// 1706769920 // +864
// 1706769056
if
(
!
ls_
)
{
if
(
HasCmsswHeaders
())
ls_
=
std
::
make_unique
<
Detail
::
LumisectionMetadata
>
(
static_cast
<
uint32_t
>
(
constants
::
N_orbits_per_lumisection
/
nOrbitsPerFile_
)
-
1
);
else
ls_
=
std
::
make_unique
<
Detail
::
LumisectionMetadata
>
();
ls_
=
std
::
make_unique
<
Detail
::
LumisectionMetadata
>
(
GetMaxFileIndexPerLumisection
());
}
ls_
->
UpdateIndex
(
current_index_
);
...
...
@@ -100,15 +118,13 @@ void OutputFileHandler::CommitLumisection() {
}
void
OutputFileHandler
::
CommitRun
()
{
assert
(
current_index_
>
0
&&
nOrbitsPerFile_
>
0
);
int
ls_index
=
1
+
(
current_index_
*
nOrbitsPerFile_
)
/
constants
::
N_orbits_per_lumisection
;
auto
lumi_number
=
ls_
->
lumisection
;
auto
ls_index
=
GetLumisectionFromFileIndex
(
current_index_
);
LOG
(
INFO
)
<<
"Lumi "
<<
std
::
to_string
(
ls_index
)
<<
". Assert that lumisection pointer exists: "
<<
bool
(
ls_
);
if
(
ls_
)
{
assert
(
lumi_number
==
static_cast
<
uint32_t
>
(
ls_index
));
auto
lumi_number
=
ls_
->
lumisection
;
assert
(
lumi_number
==
ls_index
);
if
(
IsMainPipeline
())
{
LOG
(
INFO
)
<<
"Committing lumi EOLS before EoR can be written"
;
...
...
This diff is collapsed.
Click to expand it.
src/OutputFileHandler.h
+
4
−
2
View file @
a7fdceca
...
...
@@ -39,8 +39,7 @@ class OutputFileHandler {
is_main_pipeline_
(
loc_
.
filename_suffix
==
".raw"
),
sourceID_
(
source_id
),
sink_
(
root_path_
,
root_path_
)
{
ls_
=
std
::
make_unique
<
Detail
::
LumisectionMetadata
>
(
static_cast
<
uint32_t
>
(
constants
::
N_orbits_per_lumisection
/
num_orbits_per_file
)
-
1
);
ls_
=
std
::
make_unique
<
Detail
::
LumisectionMetadata
>
(
GetMaxFileIndexPerLumisection
());
}
~
OutputFileHandler
()
{
CommitFile
(
run_
.
number
,
current_index_
);
}
...
...
@@ -49,6 +48,9 @@ class OutputFileHandler {
int
StageSlice
(
const
char
*
buffer
,
size_t
size_bytes
,
uint32_t
size_orbits
,
uint32_t
run_number
,
uint32_t
file_index
);
uint32_t
GetMaxFileIndexPerLumisection
();
uint32_t
GetLumisectionFromFileIndex
(
int
index
);
auto
HasFile
()
const
{
return
outputFile_
.
IsOpen
();
}
auto
HasCmsswHeaders
()
const
{
return
has_cmssw_headers_
;
}
auto
IsMainPipeline
()
const
{
return
is_main_pipeline_
;
}
...
...
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