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
bade57e7
Commit
bade57e7
authored
1 year ago
by
Giovanna Lazzari Miotto
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
956c3bee
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OutputFile.h
+5
-23
5 additions, 23 deletions
src/OutputFile.h
src/OutputFileHandler.cc
+2
-12
2 additions, 12 deletions
src/OutputFileHandler.cc
with
7 additions
and
35 deletions
src/OutputFile.h
+
5
−
23
View file @
bade57e7
...
...
@@ -22,18 +22,6 @@ namespace fs = std::filesystem;
class
OutputFile
{
public:
// OutputFile(FILE* filePtr, std::string fileName, FRDFileHeader_v2 fileHeader, uint32_t
// lumisection,
// uint32_t index, std::string rundir)
// : filePtr_(filePtr),
// fileName_(fileName),
// fileHeader_(fileHeader),
// lumisection_(lumisection),
// index_(index),
// rundir_(rundir) {}
// OutputFile() : filePtr_(NULL), fileName_(""), fileHeader_(0, 0, 0, 0, 0, 0) {}
OutputFile
(
std
::
string_view
filepath
,
std
::
string_view
filename
,
std
::
string_view
run_dir
,
FRDFileHeader_v2
header
,
uint32_t
num_lumisection
,
uint32_t
file_index
)
:
filepath_
(
filepath
),
...
...
@@ -43,18 +31,14 @@ class OutputFile {
lumisection_
(
num_lumisection
),
index_
(
file_index
)
{
try
{
LOG
(
FATAL
)
<<
"Attempting open file: '"
<<
filepath_
<<
"'"
;
file_
.
open
(
filepath_
,
std
::
ios_base
::
out
|
std
::
ios_base
::
binary
);
if
(
!
file_
.
is_open
())
{
LOG
(
FATAL
)
<<
"Could not open file: '"
<<
filepath_
<<
"'"
;
}
}
catch
(
std
::
exception
&
e
)
{
LOG
(
FATAL
)
<<
"Could not open file: '"
<<
filepath_
<<
"', exception: "
<<
e
.
what
();
}
catch
(
const
fstream
::
failure
&
e
)
{
LOG
(
FATAL
)
<<
"Exception opening file"
<<
filepath_
<<
"', exception: "
<<
e
.
what
();
}
}
OutputFile
(
const
OutputFile
&
)
=
delete
;
// Delete copy constructor
OutputFile
&
operator
=
(
const
OutputFile
&
)
=
delete
;
// Delete copy assignment operator
OutputFile
(
const
OutputFile
&
)
=
delete
;
OutputFile
&
operator
=
(
const
OutputFile
&
)
=
delete
;
OutputFile
(
OutputFile
&&
other
)
noexcept
:
filepath_
(
std
::
move
(
other
.
filepath_
)),
...
...
@@ -94,15 +78,13 @@ class OutputFile {
file_
.
seekp
(
pos
,
std
::
ios
::
beg
);
// Move write position
}
bool
exists
()
{
return
file_
.
is_open
();
}
std
::
string
GetFullPath
()
const
{
return
filepath_
;
}
void
Rename
(
const
std
::
string
&
new_path
)
{
fs
::
path
from
=
GetFullPath
();
fs
::
path
to
=
new_path
;
LOG
(
FATAL
)
<<
"Renaming from '"
<<
from
<<
"' to '"
<<
to
<<
"' now."
;
LOG
(
TRACE
)
<<
"Renaming from '"
<<
from
<<
"' to '"
<<
to
<<
"' now."
;
try
{
fs
::
rename
(
from
,
to
);
...
...
This diff is collapsed.
Click to expand it.
src/OutputFileHandler.cc
+
2
−
12
View file @
bade57e7
...
...
@@ -19,11 +19,6 @@ tbb::concurrent_bounded_queue<std::shared_ptr<OutputFile>> OutputFileHandler::fi
std
::
atomic
<
bool
>
OutputFileHandler
::
file_handler_running_
{
true
};
void
OutputFileHandler
::
enqueue_current_file_for_close_and_move_maybe
()
{
LOG
(
FATAL
)
<<
"____ Enqueue called."
;
LOG
(
FATAL
)
<<
"____ Is outputFile? "
<<
(
outputFile_
!=
nullptr
);
if
(
outputFile_
)
LOG
(
FATAL
)
<<
"____ Does outputFile exist()? "
<<
(
outputFile_
->
exists
());
if
(
outputFile_
&&
outputFile_
->
exists
())
{
LOG
(
TRACE
)
<<
"queueing file: "
<<
outputFile_
->
getFileName
()
<<
" for closing, queue size now "
<<
files_to_close_
.
size
();
...
...
@@ -64,10 +59,10 @@ std::shared_ptr<OutputFile>& OutputFileHandler::getFile(uint32_t run, uint32_t i
enqueue_current_file_for_close_and_move_maybe
();
if
(
is_new_run
)
{
run_NOrbits_
=
0
;
LOG
(
FATAL
)
<<
"Previous run: "
<<
current_run_number_
<<
" | New run: "
<<
run
;
LOG
(
TRACE
)
<<
"Previous run: "
<<
current_run_number_
<<
" | New run: "
<<
run
;
}
if
(
is_new_index
)
{
LOG
(
FATAL
)
<<
"Previous index: "
<<
current_index_
<<
" | New index: "
<<
index
;
LOG
(
TRACE
)
<<
"Previous index: "
<<
current_index_
<<
" | New index: "
<<
index
;
}
current_index_
=
static_cast
<
int
>
(
index
);
...
...
@@ -182,11 +177,6 @@ void OutputFileHandler::close_and_rename::operator()() const {
std
::
string
permanent_path
(
outputFile
->
getRunDir
()
+
"/"
+
outputFile
->
getFileName
());
outputFile
->
Rename
(
permanent_path
);
// std::string from = outputFile->getRunDir() + "/" + working_dir_ + "/" +
// outputFile.getFileName(); std::string to = outputFile->getRunDir() + "/" +
// outputFile.getFileName(); if (rename(from.c_str(), to.c_str()) != 0) {
// LOG(ERROR) << tools::strerror("File rename of " + outputFile.getFileName() + " failed");
// }
if
(
outputFile
->
Index
()
==
outputfilehandler_
->
max_index_per_ls_
&&
outputfilehandler_
->
getCMSSWHeaders
())
{
// end of lumisection
...
...
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