Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
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
dCache
cta
Commits
eccdf12a
Commit
eccdf12a
authored
6 years ago
by
Michael Davis
Browse files
Options
Downloads
Patches
Plain Diff
[os-generic-queues] Adds test for ContainerTraits<RetrieveQueue>::getElementSummary()
parent
246b65cf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
objectstore/AlgorithmsTest.cpp
+7
-0
7 additions, 0 deletions
objectstore/AlgorithmsTest.cpp
objectstore/RetrieveQueueAlgorithms.cpp
+3
-3
3 additions, 3 deletions
objectstore/RetrieveQueueAlgorithms.cpp
objectstore/RetrieveQueueAlgorithms.hpp
+7
-4
7 additions, 4 deletions
objectstore/RetrieveQueueAlgorithms.hpp
with
17 additions
and
7 deletions
objectstore/AlgorithmsTest.cpp
+
7
−
0
View file @
eccdf12a
...
...
@@ -184,6 +184,13 @@ TEST(ObjectStore, RetrieveQueueAlgorithms) {
popCriteria
.
files
=
100
;
auto
poppedJobs
=
retrieveAlgos
.
popNextBatch
(
"VID"
,
popCriteria
,
lc
);
ASSERT_EQ
(
poppedJobs
.
summary
.
files
,
10
);
// Validate that the summary has the same information as the popped elements
ContainerTraits
<
RetrieveQueue
>::
PoppedElementsSummary
s
;
for
(
auto
&
e
:
poppedJobs
.
elements
)
{
s
+=
ContainerTraits
<
RetrieveQueue
>::
getElementSummary
(
e
);
}
ASSERT_EQ
(
s
,
poppedJobs
.
summary
);
}
catch
(
ContainerTraits
<
RetrieveQueue
>::
OwnershipSwitchFailure
&
ex
)
{
for
(
auto
&
e
:
ex
.
failedElements
)
{
try
{
...
...
This diff is collapsed.
Click to expand it.
objectstore/RetrieveQueueAlgorithms.cpp
+
3
−
3
View file @
eccdf12a
...
...
@@ -30,7 +30,7 @@ const std::string ContainerTraits<RetrieveQueue>::c_identifierType = "vid";
// ContainerTraitsTypes
void
ContainerTraitsTypes
<
RetrieveQueue
>::
PoppedElementsSummary
::
addDeltaToLog
(
const
PoppedElementsSummary
&
previous
,
log
::
ScopedParamContainer
&
params
)
{
addDeltaToLog
(
const
PoppedElementsSummary
&
previous
,
log
::
ScopedParamContainer
&
params
)
const
{
params
.
add
(
"filesAdded"
,
files
-
previous
.
files
)
.
add
(
"bytesAdded"
,
bytes
-
previous
.
bytes
)
.
add
(
"filesBefore"
,
previous
.
files
)
...
...
@@ -40,7 +40,7 @@ addDeltaToLog(const PoppedElementsSummary &previous, log::ScopedParamContainer &
}
void
ContainerTraitsTypes
<
RetrieveQueue
>::
ContainerSummary
::
addDeltaToLog
(
const
ContainerSummary
&
previous
,
log
::
ScopedParamContainer
&
params
)
{
addDeltaToLog
(
const
ContainerSummary
&
previous
,
log
::
ScopedParamContainer
&
params
)
const
{
params
.
add
(
"queueFilesBefore"
,
previous
.
files
)
.
add
(
"queueBytesBefore"
,
previous
.
bytes
)
.
add
(
"queueFilesAfter"
,
files
)
...
...
@@ -66,7 +66,7 @@ void ContainerTraitsTypes<RetrieveQueue>::PoppedElementsList::insertBack(PoppedE
}
void
ContainerTraitsTypes
<
RetrieveQueue
>::
PoppedElementsBatch
::
addToLog
(
log
::
ScopedParamContainer
&
params
)
{
addToLog
(
log
::
ScopedParamContainer
&
params
)
const
{
params
.
add
(
"bytes"
,
summary
.
bytes
)
.
add
(
"files"
,
summary
.
files
);
}
...
...
This diff is collapsed.
Click to expand it.
objectstore/RetrieveQueueAlgorithms.hpp
+
7
−
4
View file @
eccdf12a
...
...
@@ -29,7 +29,7 @@ struct ContainerTraitsTypes<RetrieveQueue>
struct
ContainerSummary
:
public
RetrieveQueue
::
JobsSummary
{
ContainerSummary
()
:
RetrieveQueue
::
JobsSummary
()
{}
ContainerSummary
(
const
RetrieveQueue
::
JobsSummary
&
c
)
:
RetrieveQueue
::
JobsSummary
()
{}
void
addDeltaToLog
(
const
ContainerSummary
&
,
log
::
ScopedParamContainer
&
);
void
addDeltaToLog
(
const
ContainerSummary
&
,
log
::
ScopedParamContainer
&
)
const
;
};
struct
InsertedElement
{
...
...
@@ -61,7 +61,10 @@ struct ContainerTraitsTypes<RetrieveQueue>
struct
PoppedElementsSummary
{
uint64_t
bytes
=
0
;
uint64_t
files
=
0
;
bool
operator
<
(
const
PopCriteria
&
pc
)
{
bool
operator
==
(
const
PoppedElementsSummary
&
pes
)
const
{
return
bytes
==
pes
.
bytes
&&
files
==
pes
.
files
;
}
bool
operator
<
(
const
PopCriteria
&
pc
)
const
{
return
bytes
<
pc
.
bytes
&&
files
<
pc
.
files
;
}
PoppedElementsSummary
&
operator
+=
(
const
PoppedElementsSummary
&
other
)
{
...
...
@@ -69,7 +72,7 @@ struct ContainerTraitsTypes<RetrieveQueue>
files
+=
other
.
files
;
return
*
this
;
}
void
addDeltaToLog
(
const
PoppedElementsSummary
&
,
log
::
ScopedParamContainer
&
);
void
addDeltaToLog
(
const
PoppedElementsSummary
&
,
log
::
ScopedParamContainer
&
)
const
;
};
struct
PoppedElementsList
:
public
std
::
list
<
PoppedElement
>
{
void
insertBack
(
PoppedElementsList
&&
);
...
...
@@ -78,7 +81,7 @@ struct ContainerTraitsTypes<RetrieveQueue>
struct
PoppedElementsBatch
{
PoppedElementsList
elements
;
PoppedElementsSummary
summary
;
void
addToLog
(
log
::
ScopedParamContainer
&
);
void
addToLog
(
log
::
ScopedParamContainer
&
)
const
;
};
};
...
...
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