Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review 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
RadioObservatory
LOFAR
Commits
13a5807f
Commit
13a5807f
authored
8 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
Task #9607: added little performance test script
parent
8ecea43c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitattributes
+1
-0
1 addition, 0 deletions
.gitattributes
LTA/ltastorageoverview/test/db_performance_test.py
+65
-0
65 additions, 0 deletions
LTA/ltastorageoverview/test/db_performance_test.py
with
66 additions
and
0 deletions
.gitattributes
+
1
−
0
View file @
13a5807f
...
@@ -3007,6 +3007,7 @@ LTA/ltastorageoverview/lib/webservice/templates/index.html -text
...
@@ -3007,6 +3007,7 @@ LTA/ltastorageoverview/lib/webservice/templates/index.html -text
LTA/ltastorageoverview/lib/webservice/webservice.py -text
LTA/ltastorageoverview/lib/webservice/webservice.py -text
LTA/ltastorageoverview/ltastorageoverview_build.sh -text
LTA/ltastorageoverview/ltastorageoverview_build.sh -text
LTA/ltastorageoverview/test/CMakeLists.txt -text
LTA/ltastorageoverview/test/CMakeLists.txt -text
LTA/ltastorageoverview/test/db_performance_test.py -text
LTA/ltastorageoverview/test/test_lso_webservice.py -text
LTA/ltastorageoverview/test/test_lso_webservice.py -text
LTA/ltastorageoverview/test/test_lso_webservice.run -text
LTA/ltastorageoverview/test/test_lso_webservice.run -text
LTA/ltastorageoverview/test/test_lso_webservice.sh -text
LTA/ltastorageoverview/test/test_lso_webservice.sh -text
...
...
This diff is collapsed.
Click to expand it.
LTA/ltastorageoverview/test/db_performance_test.py
0 → 100755
+
65
−
0
View file @
13a5807f
#!/usr/bin/python
# Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This file is part of the LOFAR software suite.
# The LOFAR software suite is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The LOFAR software suite is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
import
logging
import
time
from
datetime
import
datetime
,
timedelta
from
ltastorageoverview
import
store
from
lofar.common.datetimeutils
import
totalSeconds
logger
=
logging
.
getLogger
()
def
main
():
from
optparse
import
OptionParser
from
lofar.common
import
dbcredentials
# Check the invocation arguments
parser
=
OptionParser
(
"
%prog [options]
"
,
description
=
'
runs the lta scraper and stores results in the speficied database.
'
)
parser
.
add_option
(
'
-V
'
,
'
--verbose
'
,
dest
=
'
verbose
'
,
action
=
'
store_true
'
,
help
=
'
verbose logging
'
)
parser
.
add_option_group
(
dbcredentials
.
options_group
(
parser
))
parser
.
set_defaults
(
dbcredentials
=
"
LTASO
"
)
(
options
,
args
)
=
parser
.
parse_args
()
logging
.
basicConfig
(
format
=
'
%(asctime)s %(levelname)s %(message)s
'
,
level
=
logging
.
DEBUG
if
options
.
verbose
else
logging
.
INFO
)
dbcreds
=
dbcredentials
.
parse_options
(
options
)
logger
.
info
(
"
Using dbcreds: %s
"
%
dbcreds
.
stringWithHiddenPassword
())
db
=
store
.
LTAStorageDb
(
dbcreds
,
options
.
verbose
)
db
.
insertSite
(
'
siteA
'
,
'
srm://srm.siteA.nl:8444
'
)
rootdir_id
=
db
.
insertRootDirectory
(
'
siteA
'
,
'
/pnfs/grid.siteA.nl/data/lofar/ops/projects/lc1_001
'
)
for
obsId
in
range
(
100000
,
100100
):
obsName
=
'
L%s
'
%
obsId
obsdir_id
=
db
.
insertSubDirectory
(
rootdir_id
,
'
/pnfs/grid.siteA.nl/data/lofar/ops/projects/lc1_001/%s
'
%
obsId
)
now
=
datetime
.
utcnow
()
fileinfos
=
[(
'
%s_SB%3d
'
%
(
obsName
,
sbNr
),
1234
,
now
,
obsdir_id
)
for
sbNr
in
range
(
0
,
488
)]
now
=
datetime
.
utcnow
()
db
.
insertFileInfos
(
fileinfos
)
elapsed
=
totalSeconds
(
datetime
.
utcnow
()
-
now
)
print
'
%s,%s
'
%
(
db
.
numFilesInTree
(
rootdir_id
),
elapsed
)
if
__name__
==
"
__main__
"
:
main
()
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