Skip to content
Snippets Groups Projects
Commit 13a5807f authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Task #9607: added little performance test script

parent 8ecea43c
Branches
Tags
No related merge requests found
...@@ -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
......
#!/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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment